*) echo COMMENT="$COMMENTOUTPUT";;
esac
fi
- ) | run_command tagtrack-$1 $METAFLAC --import-vc-from=- --no-utf8-convert "$ABCDETEMPDIR/track$1.$OUTPUT"
+ ) | run_command tagtrack-$1 $METAFLAC --import-tags-from=- --no-utf8-convert "$ABCDETEMPDIR/track$1.$OUTPUT"
;;
spx)
run_command tagtrack-$1 true
FINALPLAYLISTDIR=$(dirname "$OUTPUTDIR/$PLAYLISTFILE")
mkdir -p "$FINALPLAYLISTDIR"
if [ -s "$OUTPUTDIR/$PLAYLISTFILE" ]; then
- #echo -n "Erase any existing playlist file? [y/n] (y): " >&2
echo -n "Erase, Append to, or Keep the existing playlist file? [e/a/k] (e): " >&2
if [ "$INTERACTIVE" = "y" ]; then
while [ "$DONE" != "y" ]; do
cdparanoia|debug)
if [ "$WEHAVEACD" = "y" ]; then
vecho "Querying the CD for audio tracks..."
- TRACKS=$( $CDROMREADER -d $CDROM -Q --verbose 2>&1 | egrep '^[[:space:]]+[[:digit:]]' | tail -n 1 | awk '{print $1}' | tr -d "." | tr '\n' ' ' )
+ CDPARANOIAOUTPUT=$( $CDROMREADER -d $CDROM -Q --verbose 2>&1 )
+ RET=$?
+ if [ ! "$RET" = "0" ];then
+ echo "Warning: Something went wrong while querying the CD... Maybe a DATA CD?"
+ fi
+ TRACKS=$( echo $CDPARANOIAOUTPUT | egrep '^[[:space:]]+[[:digit:]]' | tail -n 1 | awk '{print $1}' | tr -d "." | tr '\n' ' ' )
CDPARANOIAAUDIOTRACKS="$TRACKS"
else
if [ -f "$ABCDETEMPDIR/status" ] && checkstatus cdparanoia-audio-tracks ; then
else
TRACKS=$(echo $TRACKINFO | cut -f2 -d' ')
fi
+ if echo "$TRACKS" | grep [[:digit:]] > /dev/null 2>&1 ;then :;else
+ echo "The disc does not contain any tracks. Giving up..."
+ exit 0
+ fi
echo -n "Grabbing entire CD - tracks: "
if [ ! "$PADTRACKS" = "y" ] ; then
TRACKNUMPADDING=$(echo -n $TRACKS | wc -c | tr -d ' ')
fi
# If we got the CDPARANOIA status and it is not recorded, save it now
- ## FIXME ## ! is non-portable
- if [ -n "$CDPARANOIAAUDIOTRACKS" ] && ! checkstatus cdparanoia-audio-tracks; then
- if echo "$CDPARANOIAAUDIOTRACKS" >> "$ABCDETEMPDIR/cdparanoia-audio-tracks"; then
- echo "cdparanoia-audio-tracks" >> "$ABCDETEMPDIR/status"
+ if [ -n "$CDPARANOIAAUDIOTRACKS" ]; then
+ if checkstatus cdparanoia-audio-tracks; then :; else
+ if echo "$CDPARANOIAAUDIOTRACKS" >> "$ABCDETEMPDIR/cdparanoia-audio-tracks"; then
+ echo "cdparanoia-audio-tracks" >> "$ABCDETEMPDIR/status"
+ fi
fi
fi
# return codes need to be doublechecked anyway, however
if [ "$1" = "onetrack" ]; then
# FIXME # Add the possibility of grabbing ranges of tracks in onetrack
- # FIXME # Until then, we grab the whole CD in one track, no matter what the user said
+ # FIXME # Until then, we grab the whole CD in one track, no matter what
+ # the user said
# We need the first and last track for cdda2wav
FIRSTTRACK=$2
LASTTRACK=$3
fi
CDDBTRACKNUM=$(expr $UTRACKNUM - 1)
WAVDATA="$ABCDETEMPDIR/track$UTRACKNUM.wav"
- OUTDATA="$ABCDETEMPDIR/track$UTRACKNUM.$OUTPUTTYPE"
if [ -r "$CDDBDATA" ]; then
TRACKNAME=$(grep ^TTITLE$CDDBTRACKNUM= "$CDDBDATA" | head -n 1 | cut -f2 -d= | tr -d \[:cntrl:\])
echo "Grabbing track $UTRACKNUM: $TRACKNAME..." >&2
else
echo "Grabbing track $UTRACKNUM..." >&2
fi
+ if [ "$USEPIPES" = "y" ]; then
+ TEMPARG="PIPE_$CDROMREADERSYNTAX"
+ FILEARG=${!TEMPARG}
+ REDIR=""
+ else
+ case "$CDROMREADERSYNTAX" in
+ ## FIXME ## Find the case for dagrab, to avoid exceptions
+ dagrab)
+ FILEARG="-f $WAVDATA"
+ ;;
+ *)
+ FILEARG=$WAVDATA
+ ;;
+ esac
+ REDIR=">&2"
+ fi
case "$CDROMREADERSYNTAX" in
- cdparanoia) nice $READNICE $CDROMREADER -d $CDROM $UTRACKNUM "$WAVDATA" >&2 ;;
+ cdparanoia) nice $READNICE $CDROMREADER -d $CDROM $UTRACKNUM $FILEARG $REDIR ;;
cdda2wav)
if [ "$OSFLAVOUR" = "OSX" ] ; then
# Hei, we have to unmount the device before running anything like cdda2wav in OSX
CDDA2WAVCDROM="$CDROMID"
fi
fi
- nice $READNICE $CDROMREADER -D $CDDA2WAVCDROM -t $UTRACKNUM "$WAVDATA" >&2
+ nice $READNICE $CDROMREADER -D $CDDA2WAVCDROM -t $UTRACKNUM $FILEARG $REDIR
+ ;;
+ ## FIXME ## We have an exception for dagrab, since it uses -f
+ ## FIXME ## Shall we just use -f $FILEARG ??
+ dagrab) nice $READNICE $CDROMREADER -d $CDROM -v $UTRACKNUM $FILEARG $REDIR
;;
- dagrab) nice $READNICE $CDROMREADER -d $CDROM -f $WAVDATA -v $UTRACKNUM >&2 ;;
cddafs)
# Find the track's mounted path
REALTRACKNUM=$(expr $UTRACKNUM + 0)
FILEPATH=$(find "$FILEPATH" | grep "/$REALTRACKNUM ");
# If the file exists, copy it
if [ -e "$FILEPATH" ] ; then
- nice $READNICE $CDROMREADER "$FILEPATH" "$WAVDATA" >&2
+ nice $READNICE $CDROMREADER "$FILEPATH" $FILEARG $REDIR
else
false
fi ;;
- debug) nice $READNICE $CDROMREADER -d $CDROM -w $UTRACKNUM-[:1] "$WAVDATA" >&2 ;;
+ debug) nice $READNICE $CDROMREADER -d $CDROM -w $UTRACKNUM-[:1] $FILEARG $REDIR
+ ;;
esac
RETURN=$?
- if [ "$RETURN" != "0" -o ! -s "$WAVDATA" ]; then
+ # If we get some error or we get some missing wav
+ # (as long as we dont use pipes)
+ if [ "$RETURN" != "0" -o \( ! -s "$WAVDATA" -a X"$USEPIPES" != "Xy" \) ]; then
# Thank goodness errors is only machine-parseable up to the
# first colon, otherwise this woulda sucked
if [ "$RETURN" = "0" -a ! -s "$WAVDATA" ]; then
RETURN=73 # fake a return code as cdparanoia return 0 also on aborted reads
fi
- echo "readtrack-$UTRACKNUM: $CDROMREADER returned code $RETURN" >> "$ABCDETEMPDIR/errors"
+ if [ "$USEPIPES" = "y" ]; then
+ echo "readencodetrack-$UTRACKNUM: $CDROMREADER returned code $RETURN" >> "$ABCDETEMPDIR/errors"
+ else
+ echo "readtrack-$UTRACKNUM: $CDROMREADER returned code $RETURN" >> "$ABCDETEMPDIR/errors"
+ fi
return $RETURN
else
- echo readtrack-$UTRACKNUM >> "$ABCDETEMPDIR/status"
+ if [ "$USEPIPES" = "y" ]; then
+ echo readencodetrack-$UTRACKNUM >> "$ABCDETEMPDIR/status"
+ else
+ echo readtrack-$UTRACKNUM >> "$ABCDETEMPDIR/status"
+ fi
fi
}
exit 1
fi
-# USEPIPES is not compatible with:
+# USEPIPES pre-tests, before we get into more serious stuff
+# Not compatible with:
# - multiple outputs
# - normalize
+# - lowdisk algorithm
# - anything else?
-if [ "$USEPIPES" = "y" ]; then
+if [ X"$USEPIPES" = "Xy" ]; then
if [ $(echo $OUTPUTTYPE | tr , \ | wc -w ) -gt 1 ]; then
echo "abcde error: Unix pipes not compatible with multiple outputs"
exit 1
fi
- if [ "$DONORMALIZE" = "y" ]; then
+ if [ X"$DONORMALIZE" = "Xy" ]; then
echo "abcde error: Unix pipes not compatible with normalizer"
# FIXME # Do we need to exit or shall we just disable the mode?
exit 1
fi
- if [ "$DOENCODE" = "n" ]; then
+ if [ X"$DOENCODE" = "Xn" ]; then
vecho "Disabling Unix pipes since we are not encoding!"
USEPIPES=n
fi
+ if [ X"$LOWDISK" = "Xy" ]; then
+ vecho "abcde error: Unix pipes not compatible with lowdisk algorithm"
+ exit 1
+ fi
fi
# Decide which CDROM reader we're gonna use
esac
fi
+# Rippers with USEPIPE support
+# FIXME # Include here all the rippers we can figure out support pipes
+PIPE_cdparanoia="-"
+
+# Encoders with USEPIPE support
+# FIXME # Include here all the encoders we can figure out support pipes
+PIPE_lame="-"
+PIPE_oggenc="-"
+
+# Figure out if we can use pipes with the ripper/encoder combination
+# exit otherwise
+if [ "$USEPIPES" = "y" ]; then
+ PIPERIPPERSVARCHECK="PIPE_${CDROMREADER}"
+ case "$OUTPUT" in
+ mp3)
+ PIPEENCODERSVARCHECK="PIPE_$MP3ENCODERSYNTAX" ;;
+ ogg)
+ PIPEENCODERSVARCHECK="PIPE_$OGGENCODERSYNTAX" ;;
+ flac)
+ PIPEENCODERSVARCHECK="PIPE_$FLACENCODERSYTNAX" ;;
+ spx)
+ PIPEENCODERSVARCHECK="PIPE_$SPEEXENCODER" ;;
+ mpc)
+ PIPEENCODERSVARCHECK="PIPE_$MPPENCODER" ;;
+ esac
+ if [ ! -n "${!PIPERIPPERSVARCHECK}" ] ; then
+ echo "abcde error: no support for pipes with given ripper" >&2
+ echo "read the USEPIPES file from the source tarball to help" >&2
+ echo "on a Debian system, read /usr/share/doc/abcde/USEPIPES.gz" >&2
+ exit 1;
+ fi
+ if [ ! -n "${!PIPEENCODERSVARCHECK}" ] ; then
+ echo "abcde error: no support for pipes with given encoder" >&2
+ echo "read the USEPIPES file from the source tarball to help" >&2
+ echo "on a Debian system, read /usr/share/doc/abcde/USEPIPES.gz" >&2
+ exit 1;
+ fi
+fi
+
# Make sure a buncha things exist
for X in $CDROMREADER $CDDISCID ${NEEDTAGGER+$TAGGER} $MP3ENCODER \
${NEEDCOMMENTER+$VORBISCOMMENT} ${NEEDMETAFLAC+$METAFLAC} \
${NEEDNORMALIZER+$NORMALIZER} ${NEEDEJECT+$EJECT} \
${NEEDDISKTOOL+disktool} ${NEEDCDSPEED+$CDSPEED} \
- ${NEEDVORBISGAIN+$VORBISGAIN}
+ ${NEEDVORBISGAIN+$VORBISGAIN} ${NEEDMKCUE+$MKCUE}
do
# Cut off the command-line options we just added in
X=$(echo $X | cut -d' ' -f2)
TRACKS="$FIRSTTRACK"
for UTRACKNUM in $TRACKQUEUE; do :;done
if checkstatus readtrack-$FIRSTTRACK; then :; else
- do_cdread_one $UTRACKNUM $FIRSTTRACK
- # FIXME # Allow ranges of tracks to be encoded in one track
- # FIXME # do_cdread onetrack $FIRSTTRACK $UTRACKNUM
- # Until we have it we must use:
- #do_cdread onetrack $FIRSTTRACK $UTRACKNUM
+ #do_cdread_one $UTRACKNUM $FIRSTTRACK
+ do_cdread onetrack $FIRSTTRACK $UTRACKNUM
fi
else
for UTRACKNUM in $TRACKQUEUE
do
if [ "$DOREAD" = "y" ]; then
- if checkstatus readtrack-$UTRACKNUM; then :; else
- do_cdread $UTRACKNUM
+ if [ "$USEPIPES" = "y" ]; then
+ if checkstatus readencodetrack-$UTRACKNUM; then :; else
+ do_cdread $UTRACKNUM | do_encode $UTRACKNUM %local0%
+ fi
+ else
+ if checkstatus readtrack-$UTRACKNUM; then :; else
+ do_cdread $UTRACKNUM
+ fi
if [ "$?" != "0" ]; then
# CD read failed - don't give the goahead to
# the encoder
read GOAHEAD # For blocking - will contain either "NO" or "NEXTTRACK"
if [ "$GOAHEAD" = "NO" ]; then break; fi
# find out where this track is to be encoded
- if [ "$DOENCODE" = "y" ]; then
+ if [ "$DOENCODE" = "y" -a "$USEPIPES" != "y" ]; then
# Make sure we have a place to encode this, if not, exit stage right
if [ -z "$ENCODELOCATIONS" ]; then
continue
if checkstatus normalizetrack-$UTRACKNUM; then :; else do_normalize $UTRACKNUM; fi
fi
fi
- if [ "$DOENCODE" = "y" ]; then
+ if [ "$DOENCODE" = "y" -a "$USEPIPES" != "y" ]; then
if checkstatus readtrack-$UTRACKNUM; then
#if checkstatus encodetrack-$UTRACKNUM; then :; else do_encode $UTRACKNUM $LOCATION; fi
if [ "$DONORMALIZE" = "y" ]; then
done
# Go through it again and make sure there's no distmp3 stragglers, otherwise
# we'll delete the files they're working on
-if [ "$DOENCODE" = "y" ]; then
+## FIXME ## Check also for files which are encoded using PIPEs.
+if [ "$DOENCODE" = "y" -a "$USEPIPES" != "y" ]; then
PROCEED=
until [ $PROCEED ]
do