From bef9c2d82cd6012e98838ef4fab2d65eaac03fe9 Mon Sep 17 00:00:00 2001 From: data Date: Sat, 7 May 2005 08:30:56 +0000 Subject: [PATCH 1/1] * Erase option to remove the encoded status of the tracks * Remove awk calls and set our own shell functions to do the same job * Modified the starting track so that it resets the numbers: 2-9 names the files 1-8 * Added METAFLACOPTS * Some checks for STARTTRACKNUMBER * Use FIRSTTRACK and LASTTRACK in some functions. git-svn-id: http://abcde.googlecode.com/svn/trunk@68 a0fa61bc-5347-0410-a1a9-7f54aa4e1825 --- README | 3 +- abcde | 99 +++++++++++++++++++++++++++++++++++------------- debian/changelog | 58 ++++++++++++++++++++++++++++ 3 files changed, 133 insertions(+), 27 deletions(-) diff --git a/README b/README index 2494e29..c89e4fc 100644 --- a/README +++ b/README @@ -29,8 +29,9 @@ Changes in 2.4: * Support for mkcue, to create a CUE sheet of the CD structure. * New -o :,... way of passing specific options to an output. Now we can pass specific options without having to modify a config - file. + file. This feature was already present in the last versions of the 2.2 cycle. * Unix PIPEs, as a second way to encode files with a tight disc space. +* Option to erase the "encoded" entries from the status file. Allows Changes in 2.2: diff --git a/abcde b/abcde index 7d0e6fb..fb409e2 100755 --- a/abcde +++ b/abcde @@ -30,6 +30,7 @@ echo " Specify discid to resume from (only needed if you no longer have th echo "-d " echo " Specify CDROM device to grab" echo "-D Debugging mode (equivalent to sh -x abcde)" +echo "-e Erase encoded track information from status file" 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 (localhost)" @@ -85,6 +86,31 @@ f_seq_line () echo } +# Functions to replace the need of awk {print $1} and {print $NF} +get_first() +{ +if [ X"$1" = "X" ]; then + for first in `cat`; do + break + done +else + first=$1 +fi +echo $first +} + +get_last() +{ +if [ X"$1" = "X" ]; then + for stdin in `cat`; do + last=$stdin + done +else + for last in $@ ; do :; done +fi +echo $last +} + # checkstatus [blurb] # Returns "0" if the blurb was found, returns 1 if it wasn't # Puts the blurb content, if available, on stdout. @@ -451,7 +477,7 @@ do_tag () if [ -n "$STARTTRACKNUMBER" -a -n "$STARTTRACKNUMBERTAG" ] ; then # Get the trackpadding from the current track CURRENTTRACKPADDING=$(echo -n $UTRACKNUM | wc -c) - TRACKNUM=$( printf %0.${CURRENTTRACKPADDING}d $(expr ${UTRACKNUM} + ${STARTTRACKNUMBER} - 1 )) + TRACKNUM=$( printf %0.${CURRENTTRACKPADDING}d $(expr ${UTRACKNUM} + ${STARTTRACKNUMBER} - $FIRSTTRACK )) fi for OUTPUT in $(echo $OUTPUTTYPE | tr , \ ) do @@ -505,16 +531,16 @@ do_tag () ;; flac) ## FIXME ## [ "$FLACONOGG" = "y" ] && OUTPUT=ogg - ( + ( echo ARTIST="$TRACKARTIST" echo ALBUM="$DALBUM" echo TITLE="$TRACKNAME" - if [ -n "$CDYEAR" ]; then + if [ -n "$CDYEAR" ]; then echo DATE="$CDYEAR" - fi - if [ -n "$CDGENRE" ]; then + fi + if [ -n "$CDGENRE" ]; then echo GENRE="$CDGENRE" - fi + fi echo TRACKNUMBER=${TRACKNUM:-$1} echo CDDB=$CDDBDISCID if [ "$(eval echo ${COMMENT})" != "" ]; then @@ -523,7 +549,7 @@ do_tag () *) echo COMMENT="$COMMENTOUTPUT";; esac fi - ) | run_command tagtrack-$1 $METAFLAC $METAFLACOPTS --import-tags-from=- "$ABCDETEMPDIR/track$1.$OUTPUT" + ) | run_command tagtrack-$1 $METAFLAC $METAFLACOPTS --import-tags-from=- "$ABCDETEMPDIR/track$1.$OUTPUT" ;; spx) run_command tagtrack-$1 true @@ -898,7 +924,7 @@ do_move () if [ -n "$STARTTRACKNUMBER" ] ; then # Get the trackpadding from the current track CURRENTTRACKPADDING=$(echo -n $UTRACKNUM | wc -c) - TRACKNUM=$( printf %0.${CURRENTTRACKPADDING}d $(expr ${UTRACKNUM} + ${STARTTRACKNUMBER} - 1 )) + TRACKNUM=$( printf %0.${CURRENTTRACKPADDING}d $(expr ${UTRACKNUM} + ${STARTTRACKNUMBER} - $FIRSTTRACK )) else TRACKNUM=${UTRACKNUM} fi @@ -974,7 +1000,7 @@ do_playlist () if [ -n "$STARTTRACKNUMBER" ] ; then # Get the trackpadding from the current track CURRENTTRACKPADDING=$(echo -n $UTRACKNUM | wc -c) - TRACKNUM=$( printf %0.${CURRENTTRACKPADDING}d $(expr ${UTRACKNUM} + ${STARTTRACKNUMBER} - 1 )) + TRACKNUM=$( printf %0.${CURRENTTRACKPADDING}d $(expr ${UTRACKNUM} + ${STARTTRACKNUMBER} - $FIRSTTRACK )) else TRACKNUM=${UTRACKNUM} fi @@ -1055,7 +1081,7 @@ do_discid () 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' ' ' )" + TRACKS="$( echo "$CDPARANOIAOUTPUT" | egrep '^[[:space:]]+[[:digit:]]' | tail -n 1 | get_first | tr -d "." | tr '\n' ' ' )" CDPARANOIAAUDIOTRACKS="$TRACKS" else if [ -f "$ABCDETEMPDIR/status" ] && checkstatus cdparanoia-audio-tracks ; then @@ -1070,7 +1096,7 @@ do_discid () else TRACKS=$(echo $TRACKINFO | cut -f2 -d' ') fi - if echo "$TRACKS" | grep [[:digit:]] > /dev/null 2>&1 ;then :;else + if echo "$TRACKS" | grep "[[:digit:]]" > /dev/null 2>&1 ;then :;else echo "The disc does not contain any tracks. Giving up..." exit 0 fi @@ -1105,8 +1131,6 @@ do_discid () echo Grabbing tracks: "$TRACKQUEUE" fi -# for LASTTRACK in $TRACKQUEUE; do :; done - QUEUEDTRACKS=$(echo $TRACKQUEUE | wc -w | tr -d ' ') # We have the discid, create a temp directory after it to store all the temp @@ -2086,7 +2110,7 @@ fi # 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:klLmMnNo:pPr:Rs:S:t:T:vVxw:W: opt ; do +while getopts 1a:A:bc:C:d:Dehj:klLmMnNo:pPr:Rs:S:t:T:vVxw:W: opt ; do case "$opt" in 1) ONETRACK=y ;; a) ACTIONS="$OPTARG" ;; @@ -2096,6 +2120,7 @@ while getopts 1a:A:bc:C:d:Dhj:klLmMnNo:pPr:Rs:S:t:T:vVxw:W: opt ; do C) DISCID="${OPTARG#abcde.}" ;; d) CDROM="$OPTARG" ;; D) set -x ;; + e) ERASEENCODEDSTATUS=y ;; h) usage; exit ;; e) ERASEENCODEDSTATUS=y ;; # f) FORCECDDBUSELOCAL=y ;; @@ -2129,7 +2154,13 @@ while getopts 1a:A:bc:C:d:Dhj:klLmMnNo:pPr:Rs:S:t:T:vVxw:W: opt ; do V) EXTRAVERBOSE="y" ;; x) EJECTCD="y" ;; w) COMMENT="$OPTARG" ;; - W) STARTTRACKNUMBER="${OPTARG}01" ; STARTTRACKNUMBERTAG="y" ; COMMENT="CD${OPTARG}" ;; + W) if echo $OPTARG | grep -q "[[:digit:]]" ; then + STARTTRACKNUMBER="${OPTARG}01" ; STARTTRACKNUMBERTAG="y" ; COMMENT="CD${OPTARG}" + else + echo "abcde error: argument of -W must be integer" + exit 1 + fi + ;; ?) usage; exit ;; esac done @@ -2209,7 +2240,6 @@ if [ X"$CDROM" != "X" ] ; then echo "abcde error: CDROMID not in the right format for $CDROMREADERSYNTAX" echo "Use \"cdrecord -scanbus\" to obtain a adecuate ID an set CDROMID accordingly" exit 1 - fi fi elif [ ! -e "$CDROM" -a X"$DOREAD" = "Xy" ]; then echo "abcde error: CDROM device cannot be found." >&2 @@ -2405,11 +2435,21 @@ if [ "$DISTMP3NICE" ]; then fi # Don't check for stuff if it's not needed -if [ "$REMOTEHOSTS" ]; then NEEDDISTMP3=y; fi -[ "$DONORMALIZE" = "y" ] && NEEDNORMALIZER=y -[ "$EJECTCD" = "y" ] && NEEDEJECT=y -[ ! "$CDDBAVAIL" = "n" ] && [ "$DOCDDB" = "y" ] && NEEDHTTPGET=y -[ "$CUEFILE" = "y" ] && NEEDMKCUE=y +if [ "$REMOTEHOSTS" ]; then + NEEDDISTMP3=y +fi +if [ "$DONORMALIZE" = "y" ]; then + NEEDNORMALIZER=y +fi +if [ "$EJECTCD" = "y" ]; then + NEEDEJECT=y +fi +if [ ! "$CDDBAVAIL" = "n" ] && [ "$DOCDDB" = "y" ]; then + NEEDHTTPGET=y +fi +if [ "$CUEFILE" = "y" ]; then + NEEDMKCUE=y +fi if [ X"$CDSPEEDVALUE" != "X" ]; then case "$CDROMREADERSYNTAX" in @@ -2529,6 +2569,16 @@ if [ X"$CDSPEEDVALUE" != "X" ]; then esac fi +# Define the first and last track, since we might need them later in several places +FIRSTTRACK=$( get_first $TRACKQUEUE ) +LASTTRACK=$( get_last $TRACKQUEUE ) + +if [ -f "$ABCDETEMPDIR/status" ] && [ X"$ERASEENCODEDSTATUS" = "Xy" ]; then + mv "$ABCDETEMPDIR/status" "$ABCDETEMPDIR/status.old" + grep -v ^encodetracklocation- < "$ABCDETEMPDIR/status.old" \ + | grep -v ^encode-output > "$ABCDETEMPDIR/status" +fi + # Create playlist if needed (backgroundable) and start reading in tracks ( @@ -2547,11 +2597,9 @@ if [ "$LOWDISK" = "y" ] || [ "$ONETRACK" = "y" ]; then fi if [ "$ONETRACK" = "y" ]; then - FIRSTTRACK=$( echo $TRACKQUEUE | awk '{print $1}' ) TRACKS="$FIRSTTRACK" - for UTRACKNUM in $TRACKQUEUE; do :;done if checkstatus readtrack-$FIRSTTRACK; then :; else - do_cdread onetrack $FIRSTTRACK $UTRACKNUM + do_cdread onetrack $FIRSTTRACK $LASTTRACK fi else for UTRACKNUM in $TRACKQUEUE @@ -2673,8 +2721,7 @@ fi # If we are using ONETRACK, we can proceed with the normal encoding using just the $FIRSTTRACK as TRACKQUEUE if [ "$ONETRACK" = "y" ] ; then - FIRSTTRACK=$( echo $TRACKQUEUE | awk '{print $1}') - TRACKQUEUE=$FIRSTTRACK + TRACKQUEUE="$FIRSTTRACK" TRACKS="$FIRSTTRACK" fi diff --git a/debian/changelog b/debian/changelog index d88b5b0..cdcb891 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,61 @@ +abcde (2.3.0-1) unstable; urgency=low + + * New upstream release! + * + + -- Jesus Climent Sun, 1 May 2005 23:57:18 +0300 + +abcde (2.2.6-1) unstable; urgency=low + + * Double quotation added to solve parsing * as a wildcard (Closes: #302904). + Thanks to Christian Grigis for the patch. Also (Closes: #268088). + + -- Jesus Climent Sun, 3 Apr 2005 18:18:03 +0000 + +abcde (2.2.5-1) unstable; urgency=low + + * CDPARANOIAOUTPUT missed some quotes. + * Removed some useless lines. + * If BATCH is used with ONETRACK, disable BATCH. + * Small typos with CDROM comparisons. + * Logic for CDROM variable improved. + * Version bumped to 2.2.5 and targeted to Sarge. + + -- Jesus Climent Sat, 2 Apr 2005 21:05:18 +0300 + +abcde (2.2.4-1) unstable; urgency=low + + * Changed the way we call flac, to adapt to the new times: + --import-vc-from= to --import-tags-from. + * DOSPLAYLIST was not included in the list of options. + * Options passed to the encoder by using <-o ogg:"-b 192"> are now + supported. One can modify the way abcde encodes just for the current CD. + * Unfortunatelly I forgot to add the starting number for tags in Ogg. For + MP3 is a bit more difficult, since it needs changing the X/YY code. + * Also, the order of the tags in metaflac is important for the utf8 names. + Thanks to Frederik Juul Christiani (Closes: #297482) + * Added CDROMID in the .conf file, for reader programs that need it + (Closes: #297005) + * Added a check for cdparanoia when encountering data-only CDs. + + -- Jesus Climent Tue, 1 Mar 2005 15:14:24 +0200 + +abcde (2.2.3-1) unstable; urgency=low + + * debian/control + - suggest normalize-audio, since it changed its name (Closes: #287674). + * Use the default while erasing an existing playlist (Closes: #288835). + * Does not destroy track information when a track contains "=" in the name + (Closes: #290709). + + -- Jesus Climent Sat, 22 Jan 2005 15:35:46 +0200 + +abcde (2.2.2-1) unstable; urgency=low + + * Quotes missing when evaluating a value (Closes: #284018). + + -- Jesus Climent Fri, 3 Dec 2004 09:20:18 +0200 + abcde (2.2.1-1) unstable; urgency=low * Spotted and solved a problem with the way the data tracks were detected -- 2.20.1