Added post_read().
[clinton/abcde.git] / abcde
diff --git a/abcde b/abcde
index 9b51ecc..7c83716 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -61,7 +61,8 @@ echo "       Add a comment to the CD tracks"
 echo "-W <#> Contatenate CDs: -T #01 -w \"CD #\"" 
 echo ""
 echo "Tracks is a space-delimited list of tracks to grab."
 echo "-W <#> Contatenate CDs: -T #01 -w \"CD #\"" 
 echo ""
 echo "Tracks is a space-delimited list of tracks to grab."
-echo "Ranges specified with hyphens are allowed."
+echo "Ranges specified with hyphens are allowed (i.e., 1-5)."
+echo ""
 #echo "Double hyphens are used to concatenate tracks"
 }
 
 #echo "Double hyphens are used to concatenate tracks"
 }
 
@@ -698,7 +699,7 @@ do_encode ()
                                case "$2" in
                                %local*%)
                                        case "$FLACENCODERSYNTAX" in
                                case "$2" in
                                %local*%)
                                        case "$FLACENCODERSYNTAX" in
-                                       flac) $RUN_COMMAND nice $ENCNICE $FLACENCODER  $FLACENCODEROPTS -o "$OUT" "$IN" ;; 
+                                       flac) $RUN_COMMAND nice $ENCNICE $FLACENCODER $FLACENCODEROPTS -o "$OUT" "$IN" ;; 
                                        esac
                                        ;;
        
                                        esac
                                        ;;
        
@@ -975,7 +976,9 @@ do_move ()
                                        vecho "Copying cue file to its destination directory..."
                                        if checkstatus onetrack >/dev/null ; then
                                                case $OUTPUT in
                                        vecho "Copying cue file to its destination directory..."
                                        if checkstatus onetrack >/dev/null ; then
                                                case $OUTPUT in
-                                                       mp3)
+                                                       # NOTE: Creating a cue file with the 3-char-extension files is to comply with
+                                                       # http://brianvictor.tripod.com/mp3cue.htm#details
+                                                       [a-z0-9][a-z0-9][a-z0-9])
                                                                run_command movecue-$OUTPUT cp "$ABCDETEMPDIR/$CUEFILE" "$OUTPUTDIR/$OUTPUTFILE.cue"
                                                                ;;
                                                        *)
                                                                run_command movecue-$OUTPUT cp "$ABCDETEMPDIR/$CUEFILE" "$OUTPUTDIR/$OUTPUTFILE.cue"
                                                                ;;
                                                        *)
@@ -985,6 +988,7 @@ do_move ()
                                        else
                                                run_command movecue-$OUTPUT cp "$ABCDETEMPDIR/$CUEFILE" "$OUTPUTFILEDIR/$CUEFILE"
                                        fi
                                        else
                                                run_command movecue-$OUTPUT cp "$ABCDETEMPDIR/$CUEFILE" "$OUTPUTFILEDIR/$CUEFILE"
                                        fi
+                                       echo movecue-$OUTPUT >> "$ABCDETEMPDIR/status"
                                fi
                        fi
                fi
                                fi
                        fi
                fi
@@ -1704,8 +1708,12 @@ do_cddbedit ()
                # If that fails, check for a vi
                elif which vi >/dev/null 2>&1; then
                        vi "$CDDBDATA"
                # If that fails, check for a vi
                elif which vi >/dev/null 2>&1; then
                        vi "$CDDBDATA"
+               elif [ -x /usr/bin/vim ]; then
+                       /usr/bin/vim "$CDDBDATA"
                elif [ -x /usr/bin/vi ]; then
                        /usr/bin/vi "$CDDBDATA"
                elif [ -x /usr/bin/vi ]; then
                        /usr/bin/vi "$CDDBDATA"
+               elif [ -x /bin/vi ]; then
+                       /bin/vi "$CDDBDATA"
                # nano should be on all (modern, i.e., sarge) debian systems
                elif which nano >/dev/null 2>&1 ; then
                        nano "$CDDBDATA"
                # nano should be on all (modern, i.e., sarge) debian systems
                elif which nano >/dev/null 2>&1 ; then
                        nano "$CDDBDATA"
@@ -2009,6 +2017,13 @@ pre_read ()
 :
 }
 
 :
 }
 
+# post_read
+# Empty post_read function, to be defined in the configuration file.
+post_read ()
+{
+:
+}
+
 ###############################################################################
 # End of functions
 #
 ###############################################################################
 # End of functions
 #
@@ -2107,7 +2122,7 @@ MP3ENCOPTS=
 VORBIZEOPTS=
 OGGENCOPTS=
 # flac
 VORBIZEOPTS=
 OGGENCOPTS=
 # flac
-FLACOPTS=
+FLACOPTS="-f"
 # speex
 SPEEXENCOPTS=
 # mpc
 # speex
 SPEEXENCOPTS=
 # mpc
@@ -2792,6 +2807,9 @@ if [ "$BATCH" = "y" ] || [ "$ONETRACK" = "y" ]; then
        echo NEXTTRACK
 fi
 
        echo NEXTTRACK
 fi
 
+# Execute the user-defined post_read funtion before ejecting CD
+post_read
+
 # We are now finished with the cdrom - it can be safely ejected. Note that
 # abcde will not have completed yet.
 if [ "$EJECTCD" = "y" ] && [ -x $(which $EJECT) ]; then
 # We are now finished with the cdrom - it can be safely ejected. Note that
 # abcde will not have completed yet.
 if [ "$EJECTCD" = "y" ] && [ -x $(which $EJECT) ]; then