Start the CDDB code with a sane "notfound" default.
[clinton/abcde.git] / abcde
diff --git a/abcde b/abcde
index 4fd137c..05f4248 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -1364,13 +1364,11 @@ do_discid ()
                        disktool -u ${CDROM#/dev/}
                fi
                if [ "$CDROMREADERSYNTAX" = "flac" ] ; then
-                       if [ "$TRACKINFO" = "" ]; then
+                       if $METAFLAC $METAFLACOPTS --export-cuesheet-to=- $CDROM > /dev/null 2>&1 ; then
                                TRACKINFO=$($METAFLAC $METAFLACOPTS --export-cuesheet-to=- $CDROM | $CUE2DISCID)
                        else
-                               if $METAFLAC $METAFLACOPTS --export-cuesheet-to=- $CDROM > /dev/null 2>&1 ; then :; else
-                                       log error "the input flac file does not contain a cuesheet."
-                                       exit 1
-                               fi
+                               log error "the input flac file does not contain a cuesheet."
+                               exit 1
                        fi
                else
                        case "$CDDBMETHOD" in
@@ -1654,8 +1652,6 @@ do_localcddb ()
                                if   (( $(echo "${CDDBLOCALRESULTS}" | wc -l) == 1 )); then
                                        CDDBLOCALFILE="${CDDBLOCALRESULTS}"
                                        CDDBLOCALMATCH=single
-                                       echo "${CDDBLOCALRESULTS}" : $(echo "${CDDBLOCALRESULTS}" | wc -l )
-                                       echo CDDBLOCALMATCH=single
                                elif (( $(echo "${CDDBLOCALRESULTS}" | wc -l) > 1 )); then
                                        CDDBLOCALMATCH=multiple
                                fi
@@ -1672,13 +1668,13 @@ do_localcddb ()
                # If the user has selected to check a local CDDB repo, we proceed with it
                case $CDDBLOCALMATCH in
                        multiple)
-                               echo "Processing multiple matching CDDB entries..." >> "$ABCDETEMPDIR/cddblocalchoices"
+                               echo "Processing multiple matching CDDB entries..." > "$ABCDETEMPDIR/cddblocalchoices"
                                X=0
                                echo "$CDDBLOCALRESULTS" | while read RESULT ; do
                                        X=$(expr $X + 1)
                                        # List out disc title/author and contents
                                        CDDBLOCALREAD="$ABCDETEMPDIR/cddblocalread.$X"
-                                       cat "$RESULT" >> "${CDDBLOCALREAD}"
+                                       cat "$RESULT" > "${CDDBLOCALREAD}"
                                        {       
                                                echo -n "#$X: "
                                                do_cddbparse "${CDDBLOCALREAD}" 
@@ -3332,6 +3328,8 @@ case "$CDDBMETHOD" in
 esac
 
 if [ "$DOCDDB" = "y" ]; then
+       # start with a sane default:
+       CDDBLOCALSTATUS=notfound
        if [ $CDDBUSELOCAL = "y" ]; then
                do_localcddb
        fi