Skip to content

Commit 0b85186

Browse files
authored
Merge pull request #3767 from Gemba/fb_skyscraper_v390_updates
for v3.9.0 release of Skyscraper
2 parents d34548e + 015c153 commit 0b85186

File tree

1 file changed

+72
-31
lines changed

1 file changed

+72
-31
lines changed

scriptmodules/supplementary/skyscraper.sh

Lines changed: 72 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,45 @@ function build_skyscraper() {
3434
}
3535

3636
function install_skyscraper() {
37+
local config_files=($(_config_files_skyscraper))
38+
3739
md_ret_files=(
38-
'Skyscraper'
40+
'docs'
3941
'LICENSE'
4042
'README.md'
41-
'config.ini.example'
42-
'artwork.xml'
43+
'Skyscraper'
44+
'supplementary/scraperdata/check_screenscraper_json_to_idmap.py'
45+
'supplementary/scraperdata/convert_platforms_json.py'
46+
'supplementary/scraperdata/peas_and_idmap_verify.py'
47+
)
48+
md_ret_files+=("${config_files[@]}")
49+
}
50+
51+
52+
function _config_files_skyscraper() {
53+
local config_files=(
54+
'aliasMap.csv'
4355
'artwork.xml.example1'
4456
'artwork.xml.example2'
4557
'artwork.xml.example3'
4658
'artwork.xml.example4'
47-
'platforms.json'
48-
'screenscraper.json'
49-
'mobygames.json'
50-
'tgdb_developers.json'
51-
'tgdb_publishers.json'
52-
'mameMap.csv'
53-
'aliasMap.csv'
59+
'artwork.xml'
60+
'cache/priorities.xml.example'
61+
'config.ini.example'
5462
'hints.xml'
55-
'docs'
5663
'import'
64+
'mameMap.csv'
65+
'mobygames_platforms.json'
66+
'peas.json'
67+
'platforms_idmap.csv'
5768
'resources'
58-
'cache/priorities.xml.example'
69+
'screenscraper_platforms.json'
70+
'tgdb_developers.json'
71+
'tgdb_genres.json'
72+
'tgdb_platforms.json'
73+
'tgdb_publishers.json'
5974
)
75+
echo "${config_files[@]}"
6076
}
6177

6278
# Get the location of the cached resources folder. In v3+, this changed to 'cache'.
@@ -112,7 +128,7 @@ function _purge_platform_skyscraper() {
112128
done < <(find "$configdir/all/skyscraper/$cache_folder" -maxdepth 1 -mindepth 1 -type d -exec basename {} \;)
113129

114130
# If not folders are found, show an info message instead of the selection list
115-
if [[ ${#options[@]} -eq 0 ]] ; then
131+
if [[ ${#options[@]} -eq 0 ]]; then
116132
printMsgs "dialog" "Nothing to delete ! No cached platforms found in \n$configdir/all/skyscraper/$cache_folder."
117133
return
118134
fi
@@ -171,13 +187,13 @@ function configure_skyscraper() {
171187
local cache_folder="dbs"
172188
[[ -d "$home/.skyscraper/cache" ]] && cache_folder="cache"
173189

174-
f_size=$(du --total -sm "$home/.skyscraper/$cache_folder" "$home/.skyscraper/import" 2>/dev/null | tail -n 1 | cut -f 1 )
190+
f_size=$(du --total -sm "$home/.skyscraper/$cache_folder" "$home/.skyscraper/import" 2>/dev/null | tail -n 1 | cut -f 1)
175191
printMsgs "console" "INFO: Moving the Cache and Import folders to new configuration folder (total: $f_size Mb)"
176192

177193
local folder
178194
for folder in $cache_folder import; do
179-
mv "$home/.skyscraper/$folder" "$home/.skyscraper-$folder" && \
180-
printMsgs "console" "INFO: Moved "$home/.skyscraper/$folder" to "$home/.skyscraper-$folder""
195+
mv "$home/.skyscraper/$folder" "$home/.skyscraper-$folder" &&
196+
printMsgs "console" "INFO: Moved $home/.skyscraper/$folder to $home/.skyscraper-$folder"
181197
done
182198

183199
# When having an existing installation, chances are the gamelist is generated in the ROMs folder
@@ -192,7 +208,7 @@ function configure_skyscraper() {
192208
for folder in $cache_folder import; do
193209
if [[ -d "$home/.skyscraper-$folder" ]]; then
194210
printMsgs "console" "INFO: Moving "$home/.skyscraper-$folder" back to configuration folder"
195-
mv "$home/.skyscraper-$folder" "$configdir/all/skyscraper/$folder"
211+
mv "$home/.skyscraper-$folder" "$configdir/all/skyscraper/$folder"
196212
fi
197213
done
198214

@@ -201,39 +217,64 @@ function configure_skyscraper() {
201217
}
202218

203219
function _init_config_skyscraper() {
220+
221+
local config_files=($(_config_files_skyscraper))
222+
223+
# assume new(er) install
224+
mkdir -p .pristine_cfgs
225+
for cf in "${config_files[@]}"; do
226+
bn=${cf#*/} # cut off cache/
227+
if [[ -e "$md_inst/$bn" ]]; then
228+
cp -rf "$md_inst/$bn" ".pristine_cfgs/"
229+
rm -rf "$md_inst/$bn"
230+
fi
231+
done
232+
204233
local scraper_conf_dir="$configdir/all/skyscraper"
205234

206235
# Make sure the `artwork.xml` and other conf file(s) are present, but don't overwrite them on upgrades
207236
local f_conf
208-
for f_conf in artwork.xml aliasMap.csv platforms.json screenscraper.json; do
209-
copyDefaultConfig "$md_inst/$f_conf" "$scraper_conf_dir/$f_conf"
237+
for f_conf in artwork.xml aliasMap.csv peas.json platforms_idmap.csv; do
238+
copyDefaultConfig "$md_inst/.pristine_cfgs/$f_conf" "$scraper_conf_dir/$f_conf"
210239
done
211240

212241
# If we don't have a previous config.ini file, copy the example one
213-
[[ ! -f "$scraper_conf_dir/config.ini" ]] && cp "$md_inst/config.ini.example" "$scraper_conf_dir/config.ini"
242+
if [[ ! -f "$scraper_conf_dir/config.ini" ]]; then
243+
cp "$md_inst/.pristine_cfgs/config.ini.example" "$scraper_conf_dir/config.ini"
244+
fi
214245

215-
# Artwork example files
216-
cp -f "$md_inst/artwork.xml.example"* "$scraper_conf_dir"
246+
# Artwork example files, always overwrite
247+
cp -f "$md_inst/.pristine_cfgs/artwork.xml.example"* "$scraper_conf_dir"
217248

218-
# Copy remaining resources
249+
# Copy remaining resources, always overwrite
250+
local resource_files=(
251+
'hints.xml'
252+
'mameMap.csv'
253+
'mobygames_platforms.json'
254+
'screenscraper_platforms.json'
255+
'tgdb_developers.json'
256+
'tgdb_genres.json'
257+
'tgdb_platforms.json'
258+
'tgdb_publishers.json'
259+
)
219260
local resource_file
220-
for resource_file in mameMap.csv tgdb_developers.json tgdb_publishers.json hints.xml mobygames.json; do
221-
cp -f "$md_inst/$resource_file" "$scraper_conf_dir"
261+
for resource_file in "${resource_files[@]}"; do
262+
cp -f "$md_inst/.pristine_cfgs/$resource_file" "$scraper_conf_dir"
222263
done
223264

224-
# Copy the rest of the folders
225-
cp -rf "$md_inst/resources" "$scraper_conf_dir"
265+
# Copy the resource folder
266+
cp -rf "$md_inst/.pristine_cfgs/resources" "$scraper_conf_dir"
226267

227-
# Create the import folders and add the sample files.
268+
# Create the import folders and add the definition template examples.
228269
local folder
229270
for folder in covers marquees screenshots textual videos wheels; do
230271
mkUserDir "$scraper_conf_dir/import/$folder"
231272
done
232-
cp -rf "$md_inst/import" "$scraper_conf_dir"
273+
cp -rf "$md_inst/.pristine_cfgs/import" "$scraper_conf_dir"
233274

234275
# Create the cache folder and add the sample 'priorities.xml' file to it
235276
mkUserDir "$scraper_conf_dir/cache"
236-
cp -f "$md_inst/priorities.xml.example" "$scraper_conf_dir/cache"
277+
cp -f "$md_inst/.pristine_cfgs/priorities.xml.example" "$scraper_conf_dir/cache"
237278
}
238279

239280
# Scrape one system, passed as parameter
@@ -506,7 +547,7 @@ function gui_skyscraper() {
506547
while true; do
507548
[[ -z "$ver" ]] && ver="v(Git)"
508549

509-
local cmd=(dialog --backtitle "$__backtitle" --colors --cancel-label "Exit" --help-button --no-collapse --cr-wrap --default-item "$default" --menu " Skyscraper: game scraper for EmulationStation ($ver)\\n \\n" 22 60 12)
550+
local cmd=(dialog --backtitle "$__backtitle" --colors --cancel-label "Exit" --help-button --no-collapse --cr-wrap --default-item "$default" --menu " Skyscraper: game scraper for EmulationStation ($ver)\\n \\n" 22 60 12)
510551

511552
local options=(
512553
"-" "GATHER and cache resources"

0 commit comments

Comments
 (0)