@@ -34,29 +34,45 @@ function build_skyscraper() {
34
34
}
35
35
36
36
function install_skyscraper() {
37
+ local config_files=($( _config_files_skyscraper) )
38
+
37
39
md_ret_files=(
38
- ' Skyscraper '
40
+ ' docs '
39
41
' LICENSE'
40
42
' 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'
43
55
' artwork.xml.example1'
44
56
' artwork.xml.example2'
45
57
' artwork.xml.example3'
46
58
' 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'
54
62
' hints.xml'
55
- ' docs'
56
63
' import'
64
+ ' mameMap.csv'
65
+ ' mobygames_platforms.json'
66
+ ' peas.json'
67
+ ' platforms_idmap.csv'
57
68
' 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'
59
74
)
75
+ echo " ${config_files[@]} "
60
76
}
61
77
62
78
# Get the location of the cached resources folder. In v3+, this changed to 'cache'.
@@ -112,7 +128,7 @@ function _purge_platform_skyscraper() {
112
128
done < <( find " $configdir /all/skyscraper/$cache_folder " -maxdepth 1 -mindepth 1 -type d -exec basename {} \; )
113
129
114
130
# 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
116
132
printMsgs " dialog" " Nothing to delete ! No cached platforms found in \n$configdir /all/skyscraper/$cache_folder ."
117
133
return
118
134
fi
@@ -171,13 +187,13 @@ function configure_skyscraper() {
171
187
local cache_folder=" dbs"
172
188
[[ -d " $home /.skyscraper/cache" ]] && cache_folder=" cache"
173
189
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)
175
191
printMsgs " console" " INFO: Moving the Cache and Import folders to new configuration folder (total: $f_size Mb)"
176
192
177
193
local folder
178
194
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 "
181
197
done
182
198
183
199
# When having an existing installation, chances are the gamelist is generated in the ROMs folder
@@ -192,7 +208,7 @@ function configure_skyscraper() {
192
208
for folder in $cache_folder import; do
193
209
if [[ -d " $home /.skyscraper-$folder " ]]; then
194
210
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 "
196
212
fi
197
213
done
198
214
@@ -201,39 +217,64 @@ function configure_skyscraper() {
201
217
}
202
218
203
219
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
+
204
233
local scraper_conf_dir=" $configdir /all/skyscraper"
205
234
206
235
# Make sure the `artwork.xml` and other conf file(s) are present, but don't overwrite them on upgrades
207
236
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 "
210
239
done
211
240
212
241
# 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
214
245
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 "
217
248
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
+ )
219
260
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 "
222
263
done
223
264
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 "
226
267
227
- # Create the import folders and add the sample files .
268
+ # Create the import folders and add the definition template examples .
228
269
local folder
229
270
for folder in covers marquees screenshots textual videos wheels; do
230
271
mkUserDir " $scraper_conf_dir /import/$folder "
231
272
done
232
- cp -rf " $md_inst /import" " $scraper_conf_dir "
273
+ cp -rf " $md_inst /.pristine_cfgs/ import" " $scraper_conf_dir "
233
274
234
275
# Create the cache folder and add the sample 'priorities.xml' file to it
235
276
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"
237
278
}
238
279
239
280
# Scrape one system, passed as parameter
@@ -506,7 +547,7 @@ function gui_skyscraper() {
506
547
while true ; do
507
548
[[ -z " $ver " ]] && ver=" v(Git)"
508
549
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)
510
551
511
552
local options=(
512
553
" -" " GATHER and cache resources"
0 commit comments