X-Git-Url: https://git.hcoop.net/clinton/abcde.git/blobdiff_plain/7768d908d94833925431e0c7d5afbe37cec32044..0d45aa6607798d5370bdca967c2ea66c8b279e94:/abcde diff --git a/abcde b/abcde index 38b8658..8011749 100755 --- a/abcde +++ b/abcde @@ -13,7 +13,7 @@ # # $Id$ -VERSION="2.3.99" +VERSION='2.3.99-$Revision$' usage () { @@ -34,7 +34,6 @@ echo "-d " echo " Specify CDROM device to grab (flac uses a single-track flac file)" echo "-D Debugging mode (equivalent to sh -x abcde)" echo "-e Erase encoded track information from status file" -#echo "-E Set the encoding information for the tags" echo "-f Force operations that otherwise are considered harmful. Read \"man abcde\"" echo "-g Use \"lame --nogap\" for MP3 encoding. Disables low disk and pipes flags" echo "-h This help information" @@ -87,9 +86,9 @@ log () BLURB="$1" shift case $BLURB in - error) echo "[ERR] abcde: $@" >&2 ;; - warning) echo "[WAR] $@" >&2 ;; - info) echo "[INF] $@" ;; + error) echo "[ERROR] abcde: $@" >&2 ;; + warning) echo "[WARNING] $@" >&2 ;; + info) echo "[INFO] $@" ;; esac } @@ -335,11 +334,6 @@ relpath () # do_getcddbinfo # Finds an specific field from cddbinfo -# -# TRACKNAME=$(grep ^TTITLE$CDDBTRACKNUM= "$CDDBDATA" | cut -f2 -d= | tr -d \[:cntrl:\] | sed 's/\ \+$//') -# 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/\ \+$//')" - do_getcddbinfo() { case $1 in @@ -846,20 +840,22 @@ do_encode () if [ -s "$IN" -o X"$USEPIPES" = "Xy" ] ; then for OUTPUT in $(echo $OUTPUTTYPE | tr , \ ) do - if [ "$NOGAP" = "y" ] && checkstatus encodetrack-$OUTPUT-$1 ; then - continue - fi case "$OUTPUT" in vorbis|ogg) OUT="$ABCDETEMPDIR/track$1.$OGGOUTPUTCONTAINER" + OUTPUT=$OGGOUTPUTCONTAINER ;; flac) OUT="$ABCDETEMPDIR/track$1.$FLACOUTPUTCONTAINER" + OUTPUT=$FLACOUTPUTCONTAINER ;; *) OUT="$ABCDETEMPDIR/track$1.$OUTPUT" ;; esac + if [ "$NOGAP" = "y" ] && checkstatus encodetrack-$OUTPUT-$1 ; then + continue + fi if [ X"$USEPIPES" = "Xy" ]; then RUN_COMMAND="" # We need a way to store the creation of the files when using PIPES @@ -1357,6 +1353,7 @@ do_discid () disktool -m ${CDROM#/dev/} fi WEHAVEACD=y + DISCID=$(echo $TRACKINFO | cut -f1 -d' ') else TRACKINFO=$(cat "$WAVOUTPUTDIR/abcde.$DISCID/discid") fi @@ -2547,7 +2544,7 @@ if [ "$CDROM" = "" ] ; then fi # Parse command line options -#while getopts 1a:A:bc:C:d:Dehj:klLmMnNo:pPr:Rs:S:t:T:vVxw:W: opt ; do +#while getopts 1a:bc:C:d:Dehj:klLmMnNo:pPr:Rs:S:t:T:vVxw:W: opt ; do while getopts 1a:bBc:C:d:Defghj:klLmMnNo:pPr:s:S:t:T:uvVxw:W:z opt ; do case "$opt" in 1) ONETRACK=y ;; @@ -2556,7 +2553,7 @@ while getopts 1a:bBc:C:d:Defghj:klLmMnNo:pPr:s:S:t:T:uvVxw:W:z opt ; do b) BATCHNORM=y ;; B) NOBATCHREPLAYGAIN=y ;; c) if [ -e "$OPTARG" ] ; then . "$OPTARG" ; else log error "config file \"$OPTARG\" cannot be found." ; exit 1 ; fi ;; - C) DISCID="${OPTARG#abcde.}" ;; + C) DISCID="$( echo ${OPTARG#abcde.} | tr -d /)" ;; d) CDROM="$OPTARG" ;; D) set -x ;; e) ERASEENCODEDSTATUS=y ;; @@ -3402,10 +3399,8 @@ do TRACKNUM="$FIRSTTRACK" splitvarious else -# TRACKNUM=$(printf %0.${TRACKNUMPADDING}d $(expr ${UTRACKNUM} + 0)) TRACKNUM=$UTRACKNUM CDDBTRACKNUM=$(expr $UTRACKNUM - 1) - #TRACKNAME="$(grep ^TTITLE$CDDBTRACKNUM= "$CDDBDATA" | cut -f2- -d= | tr -d \[:cntrl:\] | sed 's/\ \+$//')" do_getcddbinfo TRACKNAME splitvarious fi @@ -3481,10 +3476,6 @@ if [ "$DOREPLAYGAIN" = "y" ]; then do_replaygain fi -# FIXME # -# Check if all the encoded formats have been actually moved to the final destination -# ... - # Check to see if run_command logged any errors if [ -f "$ABCDETEMPDIR/errors" ]; then log error "The following commands failed to run:" @@ -3500,11 +3491,11 @@ fi if [ "$DOCLEAN" = "y" ] && [ ! "$FORCE" = "y" ]; then ENCODED_FORMATS=$(egrep "^encodetrack-(.{3,6})-(.{1,2})$" "$ABCDETEMPDIR/status" | cut -d"-" -f2 | sort -u | tr '\n' '|') MOVED_FORMATS=$(egrep "^movetrack-output-(.{3,6})$" "$ABCDETEMPDIR/status" | cut -d"-" -f3 | sort -u | tr '\n' '|') - decho [ENCODED_FORMATS] - decho [MOVED_FORMATS] if [ "$ENCODED_FORMATS" != "$MOVED_FORMATS" ]; then - log warning "Not all encoded formats have been requested to be moved." - log warning "Use \"-a clean -f -C $DISCID\" to force the removal of the remaining data." + log warning "The encoded formats does not match with the moved ones" + log warning "Formats encoded: $( echo $ENCODED_FORMATS | tr "|" " " )" + log warning "Formats moved: $( echo $MOVED_FORMATS | tr "|" " " )" + log warning "Use \"abcde -a clean -f -C $DISCID\" to force the removal of the remaining data." DOCLEAN=n fi fi