#!/bin/sh echo "`basename $0` (c)2006 Paul T.Threshold" echo " . use option -n|--noprompt to skip request for tracks' titles" echo " . add an integer to the cmd line to force a bitrate (96/128/160(dft)/192)" echo "" PTT_PARM=$1 if [ -f audio.cddb ]; then DTITLE=`grep DTITLE ./audio.cddb | cut -d"=" -f 2` PTTTRCKAUTH=`echo $DTITLE | cut -d"/" -f 1` PTTTRCKAUTH=`echo ${PTTTRCKAUTH% }` PTTTRCKAUTH=`echo ${PTTTRCKAUTH# }` PTTTRCKALBUM=`echo $DTITLE | cut -d"/" -f 2` PTTTRCKALBUM=`echo ${PTTTRCKALBUM# }` PTTTRCKALBUM=`echo ${PTTTRCKALBUM% }` DGENRE=`grep DGENRE ./audio.cddb | cut -d"=" -f 2` DYEAR=`grep DYEAR ./audio.cddb | cut -d"=" -f 2` echo "Encoding: $PTTTRCKAUTH - $PTTTRCKALBUM" echo " Genre: $DGENRE - Year: $DYEAR" else echo -n "Author: " read PTTTRCKAUTH; echo -n "Album : " read PTTTRCKALBUM; echo -n "Year : " read DYEAR; echo -n "Genre : " read DGENRE; fi if [ "x$DYEAR" = "x" ]; then DYEAR=0 fi IFS=$'\n\t' if [ -f audio.cdindex ]; then PTTTRCKS=`grep NumTracks audio.cdindex | cut -f2 -d">" | cut -f1 -d"<"` fi if [ "x$PTTTRCKS" = "x" ]; then PTTTRCKS=`ls -1 *.cdr | wc -l` fi for i in `ls -1 *.cdr` ; do if [ -f audio.cddb ]; then PTTTRCKNMBR=`echo $i | cut -d"." -f 1` PTTTRCKNMBR=`grep Tracknumber $PTTTRCKNMBR.inf | cut -d"=" -f 2` PTTTRCKNMBR=`echo $(($PTTTRCKNMBR))` TN=$(($PTTTRCKNMBR-1)) PTTTRCKTITLE=`grep "TTITLE$TN=" ./audio.cddb | cut -d"=" -f 2` echo "" echo $i: $PTTTRCKNMBR/$PTTTRCKS - $PTTTRCKTITLE else PTTTRCKNMBR=`echo $i | cut -d"_" -f 2 | cut -d"." -f 1` if [ "$PTT_PARM" = "-n" -o "$PTT_PARM" = "--notitle" -o "$PTT_NOTITLE" = "-n" ]; then PTTTRCKTITLE=$i shift PTT_NOTITLE="-n" PTT_PARM=$1 else echo "$i (track#$PTTTRCKNMBR):"; echo -n " Title : "; read PTTTRCKTITLE; fi fi PTT_BITRATE=160 case $PTT_PARM in 96 | 128 | 192) PTT_BITRATE=$PTT_PARM ;; *);; esac echo " Encoding: $PTTTRCKNMBR. $PTTTRCKTITLE" lame -b $PTT_BITRATE --ta "$PTTTRCKAUTH" --tl "$PTTTRCKALBUM" --ty $DYEAR --tg "$DGENRE" --tn $PTTTRCKNMBR/$PTTTRCKS --tt "$PTTTRCKTITLE" --add-id3v2 $i; id3v2 -T $PTTTRCKNMBR/$PTTTRCKS $i.mp3 printf "\a" done printf "\a" sleep 1 printf "\a" echo "Do you want to delete .inf, .cdr & audio.cd* files? [y/N]" read reply case $reply in y* | Y*) rm -f *cdr *inf audio.cddb audio.cdindex ;; *);; esac