From c26867a66f775e474d8fb084013389bda3279065 Mon Sep 17 00:00:00 2001 From: Sergio Date: Sun, 8 May 2022 11:10:06 +0200 Subject: [PATCH] updated skyscraper.sh --- chd_from_zip.sh | 29 +++++++++++++++++++---------- skyscraper.sh | 16 ++++++++-------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/chd_from_zip.sh b/chd_from_zip.sh index cd25926..3726ae8 100755 --- a/chd_from_zip.sh +++ b/chd_from_zip.sh @@ -3,24 +3,33 @@ ###uncomment below if required software not on system #sudo apt-get install -y mame-tools p7zip-full -sourcedir="$1" -destdir="$2" +readonly sourcedir="$1" +readonly destdir="$2" -#extract zip +# procesa el fitxer for zipfile in "${sourcedir}"/*.zip; do gameName="$(basename "$zipfile" .zip)" - echo -e "\e[1m\e[41mExtracting ${gameName}...\033[0m" - 7z x "${zipfile}" -o"${destdir}/${gameName}-tmp" - #convet to chd - echo -e "\e[1m\e[41mConverting ${gameName}...\033[0m" - find "${destdir}/${gameName}-tmp/" -type f -iname "*.cue" -exec chdman createcd -i {} -o "${destdir}/${gameName}.chd" \; + if [ -f "${destdir}/${gameName}.chd" ]; then + echo -e "\e[1m\e[41m${gameName}.chd already exists\033[0m" + else + echo -e "\e[1m\e[41mExtracting ${gameName}...\033[0m" + 7z x "${zipfile}" -o"${destdir}/${gameName}-tmp" - #rm temporary directory - rm -rdf "${destdir}/${gameName}-tmp" + #convet to chd + echo -e "\e[1m\e[41mConverting ${gameName}...\033[0m" + find "${destdir}/${gameName}-tmp/" -type f -iname "*.cue" -exec chdman createcd -i {} -o "${destdir}/${gameName}.chd" \; + #rm temporary directory + rm -rdf "${destdir}/${gameName}-tmp" + fi + ### uncomment below to rm the original zip archive #rm ./"$zipfile" + + if [ "$3" = "-remove" ]; then + rm ./"$zipfile" + fi echo "!!!!!!!!!!${gameName} complete..." diff --git a/skyscraper.sh b/skyscraper.sh index 2e264f6..7f05c73 100755 --- a/skyscraper.sh +++ b/skyscraper.sh @@ -3,19 +3,19 @@ ## usage USAGE=" USAGE: -$(basename "$0") [BUILD | SCRAP | BOTH] [FRONTEND] [PATH]" +$(basename "$0") [BUILD | SCRAP | BOTH] [artwork.xml] [path]" readonly USAGE -FRONTENDS="emulationstation pegasus" -readonly FRONTENDS +#FRONTENDS="emulationstation pegasus" +#readonly FRONTENDS function help_message() { echo "$USAGE" echo - echo "Where [FRONTEND] are:" - for WORD in $FRONTENDS; do - echo -e "\t$WORD" - done + #echo "Where [FRONTEND] are:" + #for WORD in $FRONTENDS; do + # echo -e "\t$WORD" + #done } ## check if there are all the parameters @@ -32,7 +32,7 @@ if ! echo "$FRONTENDS" | grep -w "$2" >/dev/null; then fi ## parameters -readonly FRONTEND="$2" +#readonly FRONTEND="$2" readonly ROM_DIR="$3" ## colors