6 while getopts i: opt; do
14 dir=$1; shift; cd "$dir"
19 /^\([0-9][0-9]\)[-. ].*\.flac$/!d
25 : ${id=$($JBDIR/bin/flaccrip-discid -a .)}
26 ntr=$(echo "$id" | sed 's:^0*\([1-9][0-9]*\)-.*$:\1:')
27 ar=$($JBDIR/bin/flaccrip-arfetch $id)
29 while read type rest; do
31 H) npress=$((npress + 1)) ;;
39 echo >&2 "$0: no AccurateRip record found: this isn't going to work"
43 echo "Found $npress pressings"
48 while :; do case "$t" in 0*) t=${t#0} ;; *) break ;; esac; done
49 l=$((t - 1)) h=$((t + 1))
50 tt=$(printf %02d "$t")
51 ll=$(printf %02d "$l")
52 hh=$(printf %02d "$h")
57 flags="${flags+$flags }-f"
58 elif [ -f "$ll"[-.\ ]*.flac ]; then
59 before=$(echo "$ll"[-.\ ]*.flac)
61 echo >&2 "$0: warning: track $l missing; using silence"
65 flags="${flags+$flags }-l"
66 elif [ -f "$hh"[-.\ ]*.flac ]; then
67 after=$(echo "$hh"[-.\ ]*.flac)
69 echo >&2 "$0: warning: track $h missing; using silence"
75 while read arty art arconf arck; do
78 cks="${cks:+$cks }$arck"
79 echo "C $arck $arconf"
85 $JBDIR/bin/flaccrip-trackoffsets \
86 $flags ${before+-b "$before"} ${after+-a "$after"} "$tt"[-.\ ]*.flac $cks
105 if (!(m in MC) || MC[m] > c) MC[m] = c;
110 print m " " MM[m] " " MC[m];