Skip to content

Commit c9fcb57

Browse files
skyscraper.sh - enhancements and fixes
Co-authored-by: Gemba <[email protected]> From detain/skyscraper#24 Gemba/skyscraper@47868bd - Switch to active fork https://github.com/Gemba/skyscraper - Compacted config file copy section by using RP provided functions, plus: - Add platforms.json, mobygames.json, screenscraper.json - Add docs/ folder - hints.txt > hints.xml (Version 3.5.4 - 14th May 2020) - Revert commit 693dbfd ("prevent hall of mirrors effect") - This is now implemented upstream in the new fork - Don't use unix:examples.files -- Copy resource files explicitly - Minor cleanup: -- Removed some trailing spaces -- Removed errant ']]'
1 parent 7fad64b commit c9fcb57

File tree

1 file changed

+24
-41
lines changed

1 file changed

+24
-41
lines changed

scriptmodules/supplementary/skyscraper.sh

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
#
1111

1212
rp_module_id="skyscraper"
13-
rp_module_desc="Scraper for EmulationStation by Lars Muldjord"
14-
rp_module_licence="GPL3 https://raw.githubusercontent.com/muldjord/skyscraper/master/LICENSE"
15-
rp_module_repo="git https://github.com/muldjord/skyscraper :_get_branch_skyscraper"
13+
rp_module_desc="Scraper for EmulationStation"
14+
rp_module_licence="GPL3 https://raw.githubusercontent.com/Gemba/skyscraper/master/LICENSE"
15+
rp_module_repo="git https://github.com/Gemba/skyscraper :_get_branch_skyscraper"
1616
rp_module_section="opt"
1717

1818
function _get_branch_skyscraper() {
19-
download https://api.github.com/repos/muldjord/skyscraper/releases/latest - | grep -m 1 tag_name | cut -d\" -f4
19+
download https://api.github.com/repos/Gemba/skyscraper/releases/latest - | grep -m 1 tag_name | cut -d\" -f4
2020
}
2121

2222
function depends_skyscraper() {
@@ -44,11 +44,15 @@ function install_skyscraper() {
4444
'artwork.xml.example2'
4545
'artwork.xml.example3'
4646
'artwork.xml.example4'
47+
'platforms.json'
48+
'screenscraper.json'
49+
'mobygames.json'
4750
'tgdb_developers.json'
4851
'tgdb_publishers.json'
4952
'mameMap.csv'
5053
'aliasMap.csv'
51-
'hints.txt'
54+
'hints.xml'
55+
'docs'
5256
'import'
5357
'resources'
5458
'cache/priorities.xml.example'
@@ -133,7 +137,7 @@ function _get_ver_skyscraper() {
133137

134138
function _check_ver_skyscraper() {
135139
ver=$(_get_ver_skyscraper)
136-
if compareVersions "$ver" lt "3.5" ]]; then
140+
if compareVersions "$ver" lt "3.5"; then
137141
printMsgs "dialog" "The version of Skyscraper you currently have installed is incompatible with options used by this script. Please update Skyscraper to the latest version to continue."
138142
return 1
139143
fi
@@ -201,42 +205,21 @@ function _init_config_skyscraper() {
201205

202206
# Make sure the `artwork.xml` and other conf file(s) are present, but don't overwrite them on upgrades
203207
local f_conf
204-
for f_conf in artwork.xml aliasMap.csv; do
205-
if [[ -f "$scraper_conf_dir/$f_conf" ]]; then
206-
cp -f "$md_inst/$f_conf" "$scraper_conf_dir/$f_conf.default"
207-
else
208-
cp "$md_inst/$f_conf" "$scraper_conf_dir"
209-
fi
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"
210210
done
211211

212212
# If we don't have a previous config.ini file, copy the example one
213-
if [[ ! -f "$scraper_conf_dir/config.ini" ]]; then
214-
cp "$md_inst/config.ini.example" "$scraper_conf_dir/config.ini"
215-
sed -i 's/\[esgamelist\]/[esgamelist]\ncacheScreenshots="false"/' "$scraper_conf_dir/config.ini"
216-
fi
213+
[[ ! -f "$scraper_conf_dir/config.ini" ]] && cp "$md_inst/config.ini.example" "$scraper_conf_dir/config.ini"
217214

218-
# Try to find the rest of the necessary files from the qmake build file
219-
# They should be listed in the `unix:examples.file` configuration line
220-
if [[ $(grep unix:examples.files "$md_build/skyscraper.pro" 2>/dev/null | cut -d= -f2-) ]]; then
221-
local files=$(grep unix:examples.files "$md_build/skyscraper.pro" | cut -d= -f2-)
222-
local file
215+
# Artwork example files
216+
cp -f "$md_inst/artwork.xml.example"* "$scraper_conf_dir"
223217

224-
for file in $files; do
225-
# Copy the files to the configuration folder. Skip config.ini, artwork.xml and aliasMap.csv
226-
if [[ $file != "artwork.xml" && $file != "config.ini" && $file != "aliasMap.csv" ]]; then
227-
cp -f "$md_build/$file" "$scraper_conf_dir"
228-
fi
229-
done
230-
else
231-
# Fallback to the known resource files list
232-
cp -f "$md_inst/artwork.xml.example"* "$scraper_conf_dir"
233-
234-
# Copy resources and readme
235-
local resource_file
236-
for resource_file in README.md mameMap.csv tgdb_developers.json tgdb_publishers.json hints.txt; do
237-
cp -f "$md_inst/$resource_file" "$scraper_conf_dir"
238-
done
239-
fi
218+
# Copy remaining resources
219+
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"
222+
done
240223

241224
# Copy the rest of the folders
242225
cp -rf "$md_inst/resources" "$scraper_conf_dir"
@@ -249,7 +232,7 @@ function _init_config_skyscraper() {
249232
cp -rf "$md_inst/import" "$scraper_conf_dir"
250233

251234
# Create the cache folder and add the sample 'priorities.xml' file to it
252-
mkdir -p "$scraper_conf_dir/cache"
235+
mkUserDir "$scraper_conf_dir/cache"
253236
cp -f "$md_inst/priorities.xml.example" "$scraper_conf_dir/cache"
254237
}
255238

@@ -342,7 +325,7 @@ function _scrape_chosen_skyscraper() {
342325
# Confirm with the user that scraping can start
343326
dialog --clear --colors --yes-label "Proceed" --no-label "Abort" --yesno "This will start the gathering process, which can take a long time if you have a large game collection.\n\nYou can interrupt this process anytime by pressing \ZbCtrl+C\Zn.\nProceed ?" 12 70 2>&1 >/dev/tty
344327
[[ ! $? -eq 0 ]] && return 1
345-
328+
346329
local choice
347330

348331
for choice in "${choices[@]}"; do
@@ -371,7 +354,7 @@ function _generate_chosen_skyscraper() {
371354
fi
372355

373356
local choices
374-
local cmd=(dialog --backtitle "$__backtitle" --ok-label "Start" --cancel-label "Back" --checklist " Select platforms for gamelist(s) generation\n\n" 22 60 16)
357+
local cmd=(dialog --backtitle "$__backtitle" --ok-label "Start" --cancel-label "Back" --checklist " Select platforms for gamelist(s) generation\n\n" 22 60 16)
375358

376359
choices=($("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty))
377360

@@ -523,7 +506,7 @@ function gui_skyscraper() {
523506
while true; do
524507
[[ -z "$ver" ]] && ver="v(Git)"
525508

526-
local cmd=(dialog --backtitle "$__backtitle" --colors --cancel-label "Exit" --help-button --no-collapse --cr-wrap --default-item "$default" --menu " Skyscraper: game scraper by Lars Muldjord ($ver)\\n \\n" 22 60 12)
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)
527510

528511
local options=(
529512
"-" "GATHER and cache resources"

0 commit comments

Comments
 (0)