chd_from_zip.sh: Cambiados los echo de colores por printf con colores y variables
chd_from_zip.sh: La orden para eliminar los ficheros estaba mal construida
This commit is contained in:
+16
-11
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
###uncomment below if required software not on system
|
||||
# Instala los programas necesarios
|
||||
#sudo apt-get install -y mame-tools p7zip-full
|
||||
|
||||
## Comprueba los parametros
|
||||
@@ -21,35 +21,40 @@ fi
|
||||
# Colores
|
||||
WHITE=$(tput setaf 7)
|
||||
RED_BG=$(tput setab 1)
|
||||
BLUE_BG=$(tput setab 4)
|
||||
NORMAL=$(tput sgr0)
|
||||
BOLD=$(tput bold)
|
||||
|
||||
# Procesa los ficheros
|
||||
for zipfile in "${sourcedir}"/*.zip; do
|
||||
gameName="$(basename "$zipfile" .zip)"
|
||||
|
||||
# Comprueba si existe ya el fichero antes de extraerlo
|
||||
if [ -f "${destdir}/${gameName}.chd" ]; then
|
||||
echo -e "\e[1m\e[41m${gameName}.chd already exists\033[0m"
|
||||
TEXT="${gameName}.chd already exists"
|
||||
printf "%s\n" "${WHITE}${RED_BG}${TEXT}${NORMAL}"
|
||||
TEXT=">> ${gameName}.chd already exists"
|
||||
printf "%s\n" "${BOLD}${WHITE}${RED_BG}${TEXT}${NORMAL}"
|
||||
else
|
||||
echo -e "\e[1m\e[41mExtracting ${gameName}...\033[0m"
|
||||
TEXT=">> Extracting ${gameName}..."
|
||||
printf "\n%s\n" "${BOLD}${WHITE}${RED_BG}${TEXT}${NORMAL}"
|
||||
7z x "${zipfile}" -o"${destdir}/${gameName}-tmp"
|
||||
|
||||
#convet to chd
|
||||
echo -e "\e[1m\e[41mConverting ${gameName}...\033[0m"
|
||||
# Convierte a CHD
|
||||
TEXT=">> Converting ${gameName}..."
|
||||
printf "\n%s\n" "${BOLD}${WHITE}${RED_BG}${TEXT}${NORMAL}"
|
||||
find "${destdir}/${gameName}-tmp/" -type f -iname "*.cue" -exec chdman createcd -i {} -o "${destdir}/${gameName}.chd" \;
|
||||
|
||||
#rm temporary directory
|
||||
# Borra el directorio temporal
|
||||
rm -rdf "${destdir}/${gameName}-tmp"
|
||||
fi
|
||||
|
||||
# Elimina el fichero
|
||||
if [ "$3" = "-remove" ]; then
|
||||
rm ./"$zipfile"
|
||||
rm "$zipfile"
|
||||
fi
|
||||
|
||||
echo "!!!!!!!!!!${gameName} complete..."
|
||||
TEXT=">> ${gameName} completed !!!"
|
||||
printf "\n%s\n" "${BOLD}${WHITE}${BLUE_BG}${TEXT}${NORMAL}"
|
||||
|
||||
done
|
||||
|
||||
echo "All done."
|
||||
printf "All done.\n"
|
||||
|
||||
Reference in New Issue
Block a user