# Copyright for this work is to expire January 1, 2010, after which it
# shall be public domain.
-VERSION="2.1pre2.2.0"
+VERSION="2.2.1"
usage ()
{
echo "This is abcde v$VERSION."
echo "Usage: abcde [options] [tracks]"
echo "Options:"
-echo "-1 Encode the whole CD in a single file"
-echo "-a Actions to perform (cddb,read,normalize,encode,tag,move,playlist,clean)"
-echo "-A Experimental actions (retag, transcode)"
-echo "-b Batch mode: enable album normalization and nogap encoding"
-echo "-c Specify a configuration file (overrides system and user config files)"
-echo "-C Specify discid to resume from (only needed if you no longer have the cd)"
-echo "-d Specify CDROM device to grab"
-echo "-D Debugging mode (equivalent to sh -x abcde)"
-echo "-h This help information"
+echo "-1 Encode the whole CD in a single file"
+echo "-a <action1[,action2]...>"
+echo " Actions to perform (cddb,read,normalize,encode,tag,move,playlist,clean)"
+#echo "-A Experimental actions (retag, transcode)"
+echo "-b Batch mode: enable album normalization and nogap encoding"
+echo "-c <file>"
+echo " Specify a configuration file (overrides system and user config files)"
+echo "-C <discid#>"
+echo " Specify discid to resume from (only needed if you no longer have the cd)"
+echo "-d <device>"
+echo " Specify CDROM device to grab"
+echo "-D Debugging mode (equivalent to sh -x abcde)"
+echo "-h This help information"
#echo "-i Tag files while encoding, when possible (local only) -NWY-"
-echo "-j Number of encoder processes to run at once"
-echo "-k Keep the wav tracks for later use"
-echo "-l Use low disk space algorithm"
-echo "-L Use local CDDB storage directory"
-echo "-n No lookup. Don't query CDDB, just create and use template"
-echo "-N Noninteractive. Never prompt for anything"
-echo "-m Modify playlist to include CRLF endings, to comply with some players"
-echo "-o Output file type(s) (ogg,mp3,flac,spx,mpc). Defaults to ogg"
-echo "-p Pad track numbers with 0's (if less than 10 tracks)"
+echo "-j <#> Number of encoder processes to run at once (localhost)"
+echo "-k Keep the wav tracks for later use"
+echo "-l Use low disk space algorithm"
+echo "-L Use local CDDB storage directory"
+echo "-n No lookup. Don't query CDDB, just create and use template"
+echo "-N Noninteractive. Never prompt for anything"
+echo "-m Modify playlist to include CRLF endings, to comply with some players"
+echo "-o <type1[,type2]...>"
+echo " Output file type(s) (ogg,mp3,flac,spx,mpc). Defaults to ogg"
+echo "-p Pad track numbers with 0's (if less than 10 tracks)"
#echo "-P Use UNIX pipes to read+encode without wav files"
-echo "-r [host1,host2...] Also encode on these remote hosts"
-echo "-R Add replaygain values to the tag info (only for ogg,flac)"
-echo "-s Start the track numbering at a given number [DEPRECATED: use -t]"
-echo "-S Set the CD speed"
+echo "-r <host1[,host2]...>"
+echo " Also encode on these remote hosts"
+echo "-R Add replaygain values to the tag info (only for ogg,flac)"
+echo "-S <#> Set the CD speed"
#echo "-t File types to preprocess (wav)"
#echo "-T Set postprocessing options"
-echo "-t Start the track numbering at a given number"
-echo "-T Start the track numbering at a given number, modifying tag numbering"
-echo "-v Show version number and exit"
-echo "-V Be a bit more verbose about what is happening behind the scenes"
-echo "-x Eject CD after all tracks are read"
-echo "-w [comment] Add a comment to the CD tracks"
+echo "-t <#> Start the track numbering at a given number"
+echo "-T <#> Same as -t but modifies tag numbering"
+echo "-v Show version number and exit"
+echo "-V Be a bit more verbose about what is happening behind the scenes"
+echo "-x Eject CD after all tracks are read"
+echo "-w <comment>"
+echo " Add a comment to the CD tracks"
+echo "-W <#> Contatenate CDs: -T #01 -w \"CD #\""
+echo ""
echo "Tracks is a space-delimited list of tracks to grab."
echo "Ranges specified with hyphens are allowed."
}
for OUTPUT in $(echo $OUTPUTTYPE | tr , \ )
do
OUT="$ABCDETEMPDIR/track$1.$OUTPUT"
- echo "Encoding track $1 of $TRACKS: $TRACKNAME..." >&2
+ run_command '' echo "Encoding track $1 of $TRACKS: $TRACKNAME..."
case "$OUTPUT" in
mp3)
case "$2" in
do
# Shares some code with do_move since the filenames have to match
CDDBTRACKNUM=$(expr $UTRACKNUM - 1)
- TRACKNAME=$(grep ^TTITLE$CDDBTRACKNUM= "$CDDBDATA" | head -n 1 | cut -f2 -d= | tr -d \[:cntrl:\])
+ TRACKNAME=$(grep ^TTITLE$CDDBTRACKNUM= "$CDDBDATA" | cut -f2 -d= | tr -d \[:cntrl:\] | sed 's/\ \+$//')
splitvarious
TRACKFILE=$(mungefilename "$TRACKNAME")
ARTISTFILE=$(mungefilename "$TRACKARTIST")
cdparanoia|debug)
if [ "$WEHAVEACD" = "y" ]; then
vecho "Querying the CD for audio tracks..."
- TRACKS=$( $CDROMREADER -Q 2>&1 | egrep '^[[:space:]]+[[:digit:]]' | tail -n 1 | awk '{print $1}' | tr -d "." | tr '\n' ' ' )
+ TRACKS=$( $CDPARANOIA -Q 2>&1 | 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
# I'll take CDDB read #3 for $400, Alex
echo -n "Which entry would you like abcde to use (0 for none)? [0-$CDDBCHOICES]: " >&2
read CDDBCHOICE
+ [ X"$CDDBCHOICE" = "X" ] && CDDBCHOICE=1
# Make sure we get a valid choice
CDCHOICENUM=$(echo $CDDBCHOICE | xargs printf %d 2>/dev/null)
while [ $CDCHOICENUM -lt 0 ] || [ $CDCHOICENUM -gt $CDDBCHOICES ]; do
:
}
+###############################################################################
# End of functions
#
# Start of execution
+###############################################################################
# Builtin defaults
CDDBURL="http://freedb.freedb.org/~cddb/cddb.cgi"
# Parse command line options
#while getopts 1a:bc:C:d:Dhj:klLnNo:pr:S:t:T:vVx opt ; do
-while getopts 1a:A:bc:C:d:Dhj:klLnNo:pr:Rs:S:t:T:vVxw: opt ; do
+while getopts 1a:A:bc:C:d:Dhj:klLnNo:pr:Rs:S:t:T:vVxw:W: opt ; do
case "$opt" in
1) ONETRACK=y ;;
a) ACTIONS="$OPTARG" ;;
V) EXTRAVERBOSE="y" ;;
x) EJECTCD="y" ;;
w) COMMENT="$OPTARG" ;;
+ W) STARTTRACKNUMBER="${OPTARG}01" ; STARTTRACKNUMBERTAG="y" ; COMMENT="CD${OPTARG}" ;;
?) usage; exit ;;
esac
done
# TRACKNUM=$(printf %0.${TRACKNUMPADDING}d $(expr ${UTRACKNUM} + 0))
TRACKNUM=$UTRACKNUM
CDDBTRACKNUM=$(expr $UTRACKNUM - 1)
- TRACKNAME=$(grep ^TTITLE$CDDBTRACKNUM= "$CDDBDATA" | head -n 1 | cut -f2 -d= | tr -d \[:cntrl:\])
+ TRACKNAME=$(grep ^TTITLE$CDDBTRACKNUM= "$CDDBDATA" | cut -f2 -d= | tr -d \[:cntrl:\] | sed 's/\ \+$//')
splitvarious
fi
fi