From 32851f8a26bc6a015c5ea215330cc1ea0c743608 Mon Sep 17 00:00:00 2001 From: epg <> Date: Sat, 23 Oct 2004 05:53:06 +0000 Subject: [PATCH] Support a -t track-count option to fa-rip and mkcue, so we can skip stupid data tracks. --- fa-flacd | 14 ++++++++++---- fa-rip | 27 ++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/fa-flacd b/fa-flacd index ad0ecd3..5f3ab7f 100755 --- a/fa-flacd +++ b/fa-flacd @@ -10,7 +10,7 @@ B, B, B - archive CDs to single FLAC files B [B<-jv>] -B +B [B<-d> I] [B<-t> I] B I @@ -249,10 +249,16 @@ artist directory (and named by album) and the ID directory is removed. =head2 FA-RIP B uses C to create a directory for storage of its -intermediate files. It uses C to create the "cue" file and +intermediate files. It uses C to create the "cue" file and then passes the number of tracks (from the "cue" file) as command-line -arguments to B. Finally, it execs C to rip -the CD to the "wav" file. +arguments to B. + +If B<-t> I is specified, that number is used instead of +counting tracks in the "cue" file, and is also passed to C +to ensure that only that number of tracks is listed in the "cue" file. +This is handy if the CD has stupid data tracks. + +Finally, it execs C to rip the CD to the "wav" file. In order for this CD to be processed by B, the user must create a "tags" file. This is usually done by renaming one of the 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} -- 2.56.0