Moved the setting of IMPORTCUEFILE outside the subshell
authorJesus Climent <mooch@debian.org>
Sun, 15 Jan 2006 22:54:10 +0000 (22:54 +0000)
committerJesus Climent <mooch@debian.org>
Sun, 15 Jan 2006 22:54:10 +0000 (22:54 +0000)
abcde

diff --git a/abcde b/abcde
index b848c9a..6ee7d3b 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -741,7 +741,7 @@ do_tag ()
                                        *)   echo COMMENT="$COMMENTOUTPUT";;
                                esac    
                        fi
-                       ) | run_command tagtrack-$OUTPUT-$1 $METAFLAC $METAFLACOPTS --import-tags-from=- "$ABCDETEMPDIR/track$1.$FLACOUTPUTCONTAINER"
+                       ) | run_command tagtrack-$OUTPUT-$1 $METAFLAC $METAFLACOPTS ${IMPORTCUESHEET:+--import-cuesheet-from="$ABCDETEMPDIR/$CUEFILE"} --import-tags-from=- "$ABCDETEMPDIR/track$1.$FLACOUTPUTCONTAINER"
                        ;;
                spx)
                        run_command tagtrack-$OUTPUT-$1 true
@@ -921,7 +921,7 @@ do_encode ()
                                case "$2" in
                                %local*%)
                                        case "$FLACENCODERSYNTAX" in
-                                       flac) $RUN_COMMAND nice $ENCNICE $FLACENCODER -f ${IMPORTCUESHEET:+--cuesheet="$ABCDETEMPDIR/$CUEFILE"} $FLACENCODEROPTS -o "$OUT" "$IN" ;; 
+                                       flac) $RUN_COMMAND nice $ENCNICE $FLACENCODER -f $FLACENCODEROPTS -o "$OUT" "$IN" ;; 
                                        esac
                                                ;;
                                        *)
@@ -2382,9 +2382,9 @@ do_cdread ()
                        echo readencodetrack-$UTRACKNUM >> "$ABCDETEMPDIR/status"
                else
                        echo readtrack-$UTRACKNUM >> "$ABCDETEMPDIR/status"
-                       if [ "$1" = "onetrack" ]; then
-                               echo onetrack >> "$ABCDETEMPDIR/status"
-                       fi
+               fi
+               if [ "$1" = "onetrack" ]; then
+                       echo onetrack >> "$ABCDETEMPDIR/status"
                fi
        fi
 }
@@ -3040,9 +3040,6 @@ do
                        [ "$FLACENCODERSYNTAX" = "default" ] && FLACENCODERSYNTAX=flac
                        [ "$DOTAG" = "y" ] && NEEDMETAFLAC=y
                        [ "$DOREPLAYGAIN" = "y" ] && NEEDMETAFLAC=y
-                       if [ "$ONETRACK" = "y" ]; then
-                               [ "$MAKECUEFILE" = "y" ] && IMPORTCUESHEET=y
-                       fi
                        ;;
                spx)
                        [ "$SPEEXENCODERSYNTAX" = "default" ] && SPEEXENCODERSYNTAX=speexenc
@@ -3379,11 +3376,20 @@ if [ -f "$ABCDETEMPDIR/status" ] && [ X"$ERASEENCODEDSTATUS" = "Xy" ]; then
                | grep -v ^encode-output > "$ABCDETEMPDIR/status"
 fi
 
+if checkstatus onetrack ; then ONETRACK=y ; fi
+
+if [ "$ONETRACK" = "y" ]; then 
+       # Reuse the CUEFILE in case we created it in a previous run
+       if CUEFILE=$(checkstatus cuefile); then
+               IMPORTCUESHEET=y
+       fi
+fi
+
 # Create playlist if needed (backgroundable) and start reading in tracks
 
 (
 
-if [ "$ONETRACK" = "y" ]; then
+if [ "$ONETRACK" = "y" ]; then
        if [ "$DOPLAYLIST" = "y" ]; then
                echo Creating playlist... >&2
                do_playlist
@@ -3397,15 +3403,13 @@ if [ "$LOWDISK" = "y" ] || [ "$ONETRACK" = "y" ]; then
 fi
 
 if [ "$ONETRACK" = "y" ]; then 
-       # Reuse the CUEFILE in case we created it in a previous run
-       if CUEFILE=$(checkstatus cuefile) >/dev/null ; then
-               IMPORTCUESHEET=y
-       fi
        TRACKS="$FIRSTTRACK"
-       if checkstatus readtrack-$FIRSTTRACK; then :; else
-               if [ "$USEPIPES" = "y" ]; then
+       if [ "$USEPIPES" = "y" ]; then
+               if checkstatus readencodetrack-$FIRSTTRACK; then :; else
                        do_cdread onetrack $FIRSTTRACK $LASTTRACK | do_encode $FIRSTTRACK %local0% > /dev/null 2>&1
-               else
+               fi
+       else
+               if checkstatus readtrack-$FIRSTTRACK; then :; else
                        do_cdread onetrack $FIRSTTRACK $LASTTRACK
                fi
        fi