# Copyright for this work is to expire January 1, 2010, after which it
# shall be public domain.
-VERSION=2.1.20-2.2pre2
+VERSION=2.2pre2
usage ()
{
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). Defaults to ogg"
+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 "-r [host1,host2...] Also encode on these remote hosts"
echo "-s Start the track numbering at a given number"
# errors, so I have not tried it myself.
## FIXME ## Needs some cleanup to determine if an empty tag sent
## FIXME ## to the encoder ends up empty.
- run_command encodetrack-$OUTPUT-$1 nice $ENCNICE $MPPENCODER $MPPENCOPTS --artist "$TRACKARTIST" --album "$DALBUM" --title "$TRACKNAME" --track "$1" --genre "$CDGENRE" --year "$CDYEAR" --comment "$COMMENT" "$IN" "$OUT"
+ run_command encodetrack-$OUTPUT-$1 nice $ENCNICE $MPPENCODER $MPPENCODEROPTS --artist "$TRACKARTIST" --album "$DALBUM" --title "$TRACKNAME" --track "$1" --genre "$CDGENRE" --year "$CDYEAR" --comment "$COMMENT" "$IN" "$OUT"
;;
esac
done
ALBUMFILE=$(mungefilename "$DALBUM")
ARTISTFILE=$(mungefilename "$TRACKARTIST")
TRACKFILE=$(mungefilename "$TRACKNAME")
- GENRE=$(echo $CDGENRE | tr "[:upper:]" "[:lower:]")
+ GENRE=$(mungegenre "$GENRE")
YEAR=$(echo $CDYEAR)
# If we want to start the tracks with a given number, we need to modify the
# TRACKNUM value before evaluation
for LASTTRACK in $TRACKQUEUE; do :; done
ALBUMFILE=$(mungefilename "$DALBUM")
ARTISTFILE=$(mungefilename "$DARTIST")
- GENRE=$(echo $CDGENRE | tr "[:upper:]" "[:lower:]")
+ GENRE=$(mungegenre "$GENRE")
if [ "$VARIOUSARTISTS" = "y" ] ; then
PLAYLISTFILE=$(eval echo $VAPLAYLISTFORMAT)
else
echo e >&2
ERASEPLAYLIST=e
fi
- [ "$ERASEPLAYLIST" = "e" -o "$ERASEPLAYLIST" = "E" ] && rm -f "$OUTPUTDIR/$PLAYLISTFILE"
+ # Once we erase the playlist, we use append to create the new one.
+ [ "$ERASEPLAYLIST" = "e" -o "$ERASEPLAYLIST" = "E" ] && rm -f "$OUTPUTDIR/$PLAYLISTFILE" && ERASEPLAYLIST=a
+ else
+ # The playlist does not exist, so we can safelly use append to create the new list
+ ERASEPLAYLIST=a
fi
if [ "$ERASEPLAYLIST" = "a" -o "$ERASEPLAYLIST" = "A" ]; then
touch "$OUTPUTDIR/$PLAYLISTFILE"
{
# Query the CD to get the track info, unless the user specified -C
if [ -z "$DISCID" ]; then
- echo -n "Getting CD track info... "
+ vecho -n "Getting CD track info... "
TRACKINFO=$($CDDISCID $CDROM)
# Make sure there's a CD in there by checking cd-discid's return code
if [ "$?" = "1" ]; then
done
[ x"$USELOCALRESP" = "x" ] && USELOCALRESP="y"
else
- echo "y">&2
+ echo "y" >&2
fi
if [ "$USELOCALRESP" = "y" ]; then
#echo "Using local copy of CDDB data"
fi
else
# We need some code to show the selected option when local repository is selected and we have found a match
- vecho "Using cached CDDB match..."
+ vecho "Using cached CDDB match..." >&2
# Display the $ABCDETEMPDIR/cddbchoices file created above
# Pick a pager so that if the tracks overflow the screen the user can still view everything
if [ -r "$ABCDETEMPDIR/cddbchoices" ]; then
exit 1
fi
CDDBDATA="$ABCDETEMPDIR/cddbread.$(checkstatus cddb-choice)"
- echo -n "Edit selected CDDB data? [y/n] ("
+ echo -n "Edit selected CDDB data? [y/n] (" >&2
if [ "$INTERACTIVE" = "y" ]; then
if [ "$UNKNOWNDISK" = "y" ]; then
echo -n "y): " >&2
FLACOPTS=
# speex
SPEEXENCOPTS=
+# mpc
+MPPENCOPTS=
ID3OPTS=
ID3V2OPTS=
# Custom filename munging:
mungefilename ()
{
- echo "$@" | sed s,:,\ -,g | tr \ / __ | tr -d \'\"\?\[:cntrl:\]
+ echo "$@" | sed s,:,\ -,g | tr \ /\* __+ | tr -d \'\"\?\[:cntrl:\]
+}
+
+# Custom genre munging:
+mungegenre ()
+{
+ echo $CDGENRE | tr "[:upper:]" "[:lower:]"
}
# pre_read