Update Downloader.bash

This commit is contained in:
RandomNinjaAtk 2023-08-11 13:24:54 +00:00 committed by GitHub
parent e14d7510ae
commit 4f6c44c549
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script is for dev purposes # This script is for dev purposes
scriptVersion="1.0" scriptVersion="1.1"
scriptName="RA-ROM-Downloader" scriptName="RA-ROM-Downloader"
#### Import Settings #### Import Settings
@ -80,66 +80,70 @@ DownloadFileVerification () {
} }
PlatformSelection () { PlatformSelection () {
if [ $platform == "snes" ]; then if [ "$platform" == "snes" ]; then
PlatformSnes PlatformSnes
elif [ $platform == "apple2" ]; then elif [ "$platform" == "apple2" ]; then
PlatformApple2 PlatformApple2
elif [ $platform == "megadrive" ]; then elif [ "$platform" == "megadrive" ]; then
PlatformMegadrive PlatformMegadrive
elif [ $platform == "n64" ]; then elif [ "$platform" == "n64" ]; then
PlatformN64 PlatformN64
elif [ $platform == "megaduck" ]; then elif [ "$platform" == "megaduck" ]; then
PlatformMegaduck PlatformMegaduck
elif [ $platform == "pokemini" ]; then elif [ "$platform" == "pokemini" ]; then
PlatformPokemini PlatformPokemini
elif [ $platform == "virtualboy" ]; then elif [ "$platform" == "virtualboy" ]; then
PlatformVirtualboy PlatformVirtualboy
elif [ $platform == "nes" ]; then elif [ "$platform" == "nes" ]; then
PlatformNes PlatformNes
elif [ $platform == "arduboy" ]; then elif [ "$platform" == "arduboy" ]; then
PlatformArduboy PlatformArduboy
elif [ $platform == "sega32x" ]; then elif [ "$platform" == "sega32x" ]; then
PlatformSega32x PlatformSega32x
elif [ $platform == "mastersystem" ]; then elif [ "$platform" == "mastersystem" ]; then
PlatformMastersystem PlatformMastersystem
elif [ $platform == "sg1000" ]; then elif [ "$platform" == "sg1000" ]; then
PlatformSg1000 PlatformSg1000
elif [ $platform == "atarilynx" ]; then elif [ "$platform" == "atarilynx" ]; then
PlatformAtarilynx PlatformAtarilynx
elif [ $platform == "jaguar" ]; then elif [ "$platform" == "jaguar" ]; then
PlatformJaguar PlatformJaguar
elif [ $platform == "gb" ]; then elif [ "$platform" == "gb" ]; then
PlatformGameBoy PlatformGameBoy
elif [ $platform == "gbc" ]; then elif [ "$platform" == "gbc" ]; then
PlatformGameBoyColor PlatformGameBoyColor
elif [ $platform == "gba" ]; then elif [ "$platform" == "gba" ]; then
PlatformGameBoyAdvance PlatformGameBoyAdvance
elif [ $platform == "gamegear" ]; then elif [ "$platform" == "gamegear" ]; then
PlatformGameGear PlatformGameGear
elif [ $platform == "atari2600" ]; then elif [ "$platform" == "atari2600" ]; then
PlatformAtari2600 PlatformAtari2600
elif [ $platform == "atari7800" ]; then elif [ "$platform" == "atari7800" ]; then
PlatformAtari7800 PlatformAtari7800
elif [ $platform == "nds" ]; then elif [ "$platform" == "nds" ]; then
PlatformNintendoDS PlatformNintendoDS
elif [ $platform == "colecovision" ]; then elif [ "$platform" == "colecovision" ]; then
PlatformColecoVision PlatformColecoVision
elif [ $platform == "intellivision" ]; then elif [ "$platform" == "intellivision" ]; then
PlatformIntellivision PlatformIntellivision
elif [ $platform == "ngp" ]; then elif [ "$platform" == "ngp" ]; then
PlatformNeoGeoPocket PlatformNeoGeoPocket
elif [ $platform == "ndsi" ]; then elif [ "$platform" == "ndsi" ]; then
PlatformNintendoDSi PlatformNintendoDSi
elif [ $platform == "wasm4" ]; then elif [ "$platform" == "wasm4" ]; then
PlatformNintendoWASM-4 PlatformNintendoWASM-4
elif [ $platform == "channelf" ]; then elif [ "$platform" == "channelf" ]; then
PlatformNintendoChannelF PlatformNintendoChannelF
elif [ $platform == "o2em" ]; then elif [ "$platform" == "o2em" ]; then
PlatformO2em PlatformO2em
elif [ $platform == "arcadia" ]; then elif [ "$platform" == "arcadia" ]; then
PlatformArcadia PlatformArcadia
elif [ $platform == "supervision" ]; then elif [ "$platform" == "supervision" ]; then
PlatformSupervision PlatformSupervision
elif [ "$platform" == "wswan" ]; then
PlatformWonderSwan
elif [ "$platform" == "vectrex" ]; then
PlatformVectrex
else else
log "ERROR :: No Platforms Selected, exiting..." log "ERROR :: No Platforms Selected, exiting..."
exit exit
@ -152,26 +156,35 @@ DownloadRomCountSummary () {
platformCount=$(find "/$romPath" -maxdepth 1 -mindepth 1 -type d | wc -l) platformCount=$(find "/$romPath" -maxdepth 1 -mindepth 1 -type d | wc -l)
log "$romCount ROMS downloaded on $platformCount different platforms!!!" log "$romCount ROMS downloaded on $platformCount different platforms!!!"
log "Platform breakdown...." log "Platform breakdown...."
echo "Platforms ($platformCount):;Total:;Released:;Hack/Homebrew/Proto/Unlicensed:" > temp echo "Platforms ($platformCount):;Total:;Released:;Hack/Homebrew/Proto/Unlicensed:" > /config/temp
for romfolder in $(find "/$romPath" -maxdepth 1 -mindepth 1 -type d); do for romfolder in $(find "/$romPath" -maxdepth 1 -mindepth 1 -type d); do
platform="$(basename "$romfolder")" platform="$(basename "$romfolder")"
PlatformSelection PlatformSelection
platformRomCount=$(find "$romPath/$platformFolder" -type f | wc -l) platformRomCount=$(find "$romPath/$platformFolder" -type f | wc -l)
platformRomSubCount=$(find "$romPath/$platformFolder" -mindepth 2 -type f | wc -l) platformRomSubCount=$(find "$romPath/$platformFolder" -mindepth 2 -type f | wc -l)
platformMainRomCount=$(( $platformRomCount - $platformRomSubCount )) platformMainRomCount=$(( $platformRomCount - $platformRomSubCount ))
echo "$platformName;$platformRomCount;$platformMainRomCount;$platformRomSubCount" >> temp echo "$platformName;$platformRomCount;$platformMainRomCount;$platformRomSubCount" >> /config/temp
done done
platformRomSubCount=$(find "$romPath" -mindepth 3 -type f | wc -l) platformRomSubCount=$(find "$romPath" -mindepth 3 -type f | wc -l)
platformMainRomCount=$(( $romCount - $platformRomSubCount )) platformMainRomCount=$(( $romCount - $platformRomSubCount ))
echo "Totals:;$romCount;$platformMainRomCount;$platformRomSubCount" >> temp echo "Totals:;$romCount;$platformMainRomCount;$platformRomSubCount" >> /config/temp
data=$(cat temp | column -s";" -t) data=$(cat /config/temp | column -s";" -t)
echo "$data" echo "$data"
rm temp
} }
#### Platforms #### Platforms
PlatformVectrex () {
platformName="Vectrex"
platformArchiveContentsUrl="https://archive.org/download/retroachievements_collection_v5/Vectrex/"
platformFolder="vectrex"
consoleRomFileExt=".bin, .gam, .vec, .zip, .7z"
raConsoleId="46"
uncompressRom="false"
compressRom="false"
}
PlatformSupervision () { PlatformSupervision () {
platformName="WonWatara Supervision" platformName="Watara Supervision"
platformArchiveContentsUrl="https://archive.org/download/retroachievements_collection_v5/Watara%20Supervision/" platformArchiveContentsUrl="https://archive.org/download/retroachievements_collection_v5/Watara%20Supervision/"
platformFolder="supervision" platformFolder="supervision"
consoleRomFileExt=".sv, .zip, .7z" consoleRomFileExt=".sv, .zip, .7z"
@ -500,7 +513,7 @@ PlatformNintendoChannelF () {
DownloadRomCountSummary DownloadRomCountSummary
log "######################################" log "######################################"
log "Processing platforms..." log "Processing platforms..."
platform=""
platformsToProcessNumber=0 platformsToProcessNumber=0
IFS=',' read -r -a filters <<< "$platforms" IFS=',' read -r -a filters <<< "$platforms"
for platform in "${filters[@]}" for platform in "${filters[@]}"
@ -508,13 +521,13 @@ do
platformToProcessNumber=$(( $platformToProcessNumber + 1 )) platformToProcessNumber=$(( $platformToProcessNumber + 1 ))
done done
platform=""
processNumber=0 processNumber=0
IFS=',' read -r -a filters <<< "$platforms" IFS=',' read -r -a filters <<< "$platforms"
for platform in "${filters[@]}" for platform in "${filters[@]}"
do do
processNumber=$(( $processNumber + 1 )) processNumber=$(( $processNumber + 1 ))
PlatformSelection PlatformSelection
log "$processNumber/$platformToProcessNumber :: $platformName :: Starting..." log "$processNumber/$platformToProcessNumber :: $platformName :: Starting..."
log "$processNumber/$platformToProcessNumber :: $platformName :: Finding ROMS..." log "$processNumber/$platformToProcessNumber :: $platformName :: Finding ROMS..."
CreatePlatformRomList "$platformArchiveContentsUrl" CreatePlatformRomList "$platformArchiveContentsUrl"