You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.3 KiB
Bash

#!/usr/bin/env bash
# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
helpmsg() {
printf "%s\n" "desc: convert game disc image to chd (Playstation, Dreamcast, Sega Saturn, Sega CD/Mega CD, PC Engine CD/TurboGrafx CD, Panasonic 3DO ...etc)"
printf "%s\n" "demo: https://youtu.be/DdPjj0XGlpo"
printf "%s\n" "depend: mame-tools"
printf "%s\n" " task-spooler (optional)"
printf "\n"
printf "%s\n" "usage: ${0##*/} [cue|gdi]"
printf "\n"
printf "%s\n" " $ ${0##*/} file.cue"
printf "%s\n" " $ ${0##*/} file1.cue file2.gdi file3.cue"
printf "%s\n" " $ ${0##*/} -t *.cue"
printf "%s\n" " $ ${0##*/} *.cue"
printf "%s\n" " $ ${0##*/} *.gdi"
printf "\n"
printf "%s\n" "options:"
printf "%s\n" " -t, --tsp queue with task-spooler (TS_SOCKET=/tmp/sh tsp)"
printf "%s\n" " -h, --help display this help message"
printf "\n"
}
if [ $# -lt 1 ]; then
helpmsg
exit 1
elif [ "$1" = -h ] || [ "$1" = --help ]; then
helpmsg
exit 0
elif [ "$1" = -t ] || [ "$1" = --tsp ]; then
myArray=("${@:2}")
for arg in "${myArray[@]}"; do
TS_SOCKET=/tmp/sh tsp chdman createcd -i "$arg" -o "${arg%.*}.chd"
done
else
myArray=("$@")
for arg in "${myArray[@]}"; do
chdman createcd -i "$arg" -o "${arg%.*}.chd"
done
fi