X-Git-Url: https://diplodocus.org/git/flac-archive/blobdiff_plain/b22eaf65267e9b1c3bfacfd6e81462e183a158c9..32851f8a26bc6a015c5ea215330cc1ea0c743608:/fa-rip diff --git a/fa-rip b/fa-rip index c331648..4755822 100755 --- a/fa-rip +++ b/fa-rip @@ -19,6 +19,24 @@ function get_cddev { return 1 } +trackcount= +while getopts 'd:t:' ch; do + case ${ch} in + d) + CDDEV=${OPTARG} + export CDDEV + ;; + t) + trackcount=${OPTARG} + ;; + ?) + echo 'fa-rip [-t track-count]' >&2 + exit 2 + ;; + esac +done +shift $((${OPTIND} - 1)) + if [[ -z ${CDDEV} ]]; then if ! get_cddev; then echo 'CDDEV environment variable not set, defaults did not work' >&2 @@ -30,9 +48,12 @@ fi dir=$(mktemp -d flac-archive.XXXXXXXXXX) cd ${dir} -mkcue ${CDDEV} > cue - -trackcount=$(grep -c 'TRACK.*AUDIO' cue) +if [[ -z ${trackcount} ]]; then + mkcue ${CDDEV} > cue + trackcount=$(grep -c 'TRACK.*AUDIO' cue) +else + mkcue -t ${trackcount} ${CDDEV} > cue +fi fa-tags ${trackcount}