r267@frost: data | 2006-01-22 21:28:41 +0200
authordata <data@a0fa61bc-5347-0410-a1a9-7f54aa4e1825>
Sun, 22 Jan 2006 21:20:27 +0000 (21:20 +0000)
committerdata <data@a0fa61bc-5347-0410-a1a9-7f54aa4e1825>
Sun, 22 Jan 2006 21:20:27 +0000 (21:20 +0000)
 Update README and TODO.
 Updated diff option for recursive CDDB. Using now a diffentries function.

git-svn-id: http://abcde.googlecode.com/svn/trunk@192 a0fa61bc-5347-0410-a1a9-7f54aa4e1825

README
TODO
abcde
abcde.1

diff --git a/README b/README
index f2baf6a..65393ba 100644 (file)
--- a/README
+++ b/README
@@ -27,6 +27,9 @@ Changes in 2.4:
   parsed CDDB entries.
 * Added SHOWCDDBFIELDS to define wether to show the YEAR and GENRE fields from
   the CDDB output.
+* Added the possibility of embeding a cuesheet on a singletrack flac file. A
+  single BACKUP flag is most likely needed to use all the needed flags:
+  "abcde -1 -M -o flac"
 * Added the possibility of using a singletrack flac file with an embeded
   cuesheet as a source to extract tracks from.
 * Added replaygain for Ogg/Vorbis and Ogg/FLAC.
@@ -40,8 +43,7 @@ Changes in 2.4:
  
 Changes in 2.3:
 * Support for mkcue, to create a CUE sheet of the CD structure. It can be used
-  with "-1" to create a backup, so that later on the original CD can be
-  recreated.
+  with "-1" to create a backup, so that later the original CD can be recreated.
 * New -o <output(1)>:<options(1)>,... way of passing specific options to an
   output. Now we can pass specific options without having to modify a config
   file. This feature was already present in the last versions of the 2.2 cycle.
diff --git a/TODO b/TODO
index d3ac97d..d231a52 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,14 +1,10 @@
 TODO:
 ----
-* flac with force.
-
 * Get the multiple choices in both local and remote CDDB to use the same
   functions.
 
 * Add musicbrainz support: http://www.rupamsunyata.org/~decklin/musicbrainz-get-tracks
 
-* flacdecode (to extract files from a -1 flac file) (ALMOST READY!)
-
 * read the TOC and CDTEXT files and store them
 
 * read_and_encode_and_tag? :)
@@ -44,6 +40,3 @@ TODO:
   invoked once per wav.
 
   Abcde should halt when a problem occurs, so it can be manually resolved.
-
-* AAC support (faac should be free?)
-
diff --git a/abcde b/abcde
index e123408..9367555 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -349,6 +349,39 @@ checkexec ()
        fi
 }
 
+# diffentries <filename> <max_value> <entry1>,<entry2>
+diffentries ()
+{
+       FILENAME=$1
+       shift
+       local CDDBDIFFCHOICES=$1
+       shift
+       local CDDBDIFFCHOICE="$@"
+       if [ ! X"$DIFF" = "X" ]; then
+               PARSECHOICE1=$(echo $CDDBDIFFCHOICE | cut -d"," -f1 | xargs printf %d 2>/dev/null)
+               PARSECHOICE2=$(echo $CDDBDIFFCHOICE | cut -d"," -f2 | xargs printf %d 2>/dev/null)
+               if [ $PARSECHOICE1 -lt 1 ] || [ $PARSECHOICE1 -gt $CDDBDIFFCHOICES ] || \
+                  [ $PARSECHOICE2 -lt 1 ] || [ $PARSECHOICE2 -gt $CDDBDIFFCHOICES ] || \
+                  [ $PARSECHOICE1 -eq $PARSECHOICE2 ]; then 
+                       echo "Invalid diff range. Please select two coma-separated numbers between 1 and $CDDBDIFFCHOICES" >&2
+               else
+                       # We parse the 2 choices to diff, store them in temporary files and diff them.
+                       for PARSECHOICE in $(echo $CDDBDIFFCHOICE | tr , \ ); do
+                               do_cddbparse "$ABCDETEMPDIR/$FILENAME.$PARSECHOICE" > "$ABCDETEMPDIR/$FILENAME.parsechoice.$PARSECHOICE"
+                       done
+                       echo "Showing diff between choices $PARSECHOICE1 and $PARSECHOICE2..." > "$ABCDETEMPDIR/$FILENAME.diff"
+                       $DIFF $DIFFOPTS "$ABCDETEMPDIR/$FILENAME.parsechoice.$PARSECHOICE1" "$ABCDETEMPDIR/$FILENAME.parsechoice.$PARSECHOICE2" >> "$ABCDETEMPDIR/$FILENAME.diff"
+                       if [ $(cat "$ABCDETEMPDIR/$FILENAME.diff" | wc -l) -ge 24 ]; then
+                               page "$ABCDETEMPDIR/$FILENAME.diff"
+                       else
+                               cat "$ABCDETEMPDIR/$FILENAME.diff" >&2
+                       fi
+               fi
+       else
+               echo "The diff program was not found in your path. Please choose a number between 0 and $CDDBDIFFCHOICES." >&2
+       fi
+}
+
 # do_getcddbinfo
 # Finds an specific field from cddbinfo
 do_getcddbinfo()
@@ -1690,14 +1723,30 @@ do_localcddb ()
                                                echo ""
                                        } >> "$ABCDETEMPDIR/cddblocalchoices"
                                done
+                               if [ $(cat "$ABCDETEMPDIR/cddblocalchoices" | wc -l) -ge 24 ]; then
+                                       page "$ABCDETEMPDIR/cddblocalchoices"
+                               else
+                                       # It's all going to fit in one page, cat it
+                                       cat "$ABCDETEMPDIR/cddblocalchoices" >&2
+                               fi
                                CDDBLOCALCHOICES=$( echo "$CDDBLOCALRESULTS" | wc -l )
-                               cat "$ABCDETEMPDIR/cddblocalchoices"
+                               # Setting the choice to an impossible integer to avoid errors in the numeric comparisons
                                CDDBLOCALCHOICENUM=-1
                                if [ "$INTERACTIVE" = "y" ]; then
                                        while [ $CDDBLOCALCHOICENUM -lt 0 ] || [ $CDDBLOCALCHOICENUM -gt $CDDBLOCALCHOICES ]; do
                                                echo -n "Locally cached CDDB entries found. Which one would you like to use (0 for none)? [0-$CDDBLOCALCHOICES]: " >&2
-                                               read CDDBLOCALCHOICENUM
-                                               [ x"$CDDBLOCALCHOICENUM" = "x" ] && CDDBLOCALCHOICENUM="1"
+                                               read CDDBLOCALCHOICE
+                                               [ x"$CDDBLOCALCHOICE" = "x" ] && CDDBLOCALCHOICE="1"
+                                               # FIXME # Introduce diff's
+                                               if echo $CDDBLOCALCHOICE | egrep -q "[[:space:]]*[[:digit:]]+,[[:digit:]]+[[:space:]]*" ; then
+                                                       diffentries cddblocalread "$CDDBLOCALCHOICES" "$CDDBLOCALCHOICE"
+                                               elif echo $CDDBLOCALCHOICE | egrep -q "[[:space:]]*[[:digit:]]+[[:space:]]*" ; then
+                                                       # Make sure we get a valid choice
+                                                       CDDBLOCALCHOICENUM=$(echo $CDDBLOCALCHOICE | xargs printf %d 2>/dev/null)
+                                                       if [ $CDDBLOCALCHOICENUM -lt 0 ] || [ $CDDBLOCALCHOICENUM -gt $CDDBLOCALCHOICES ]; then
+                                                               echo "Invalid selection. Please choose a number between 0 and $CDDBLOCALCHOICES." >&2
+                                                       fi
+                                               fi
                                        done
                                else
                                        ### FIXME ###
diff --git a/abcde.1 b/abcde.1
index 2ca1409..9719f2a 100644 (file)
--- a/abcde.1
+++ b/abcde.1
@@ -10,7 +10,8 @@ tagging or commenting it, is very involved.
 .BR abcde
 is designed to automate this. It will take an entire CD and convert it into
 a compressed audio format - Ogg/Vorbis, MPEG Audio Layer III, Free Lossless
-Audio Codec (FLAC), Ogg/Speex or MPP/MP+(Musepack). With one command, it will:
+Audio Codec (FLAC), Ogg/Speex, MPP/MP+(Musepack) and/or M4A (AAC) format(s).
+With one command, it will:
 .TP
 .B *
 Do a CDDB query over the Internet to look up your CD or use a locally stored CDDB entry
@@ -43,8 +44,8 @@ Repeat until finished
 .B \-1
 Encode the whole CD in a single file. The resulting file uses the CD title
 for tagging. If the resulting format is a flac file with an embeded cuesheet,
-the file can be used as a source for creating other formats.
-.TP
+the file can be used as a source for creating other formats. Use "-1 -M -o
+flac" for obtaining such a file .TP
 .B \-a [actions]
 Comma-delimited list of actions to perform. Can be one or more of:
 cddb, read, normalize, encode, tag, move, replaygain, playlist, clean. Normalize
@@ -169,7 +170,7 @@ Same as \-t but changes also the internal (tag) numbering. Keep in mind that
 the default TRACK tag for MP3 is $T/$TRACKS so it is changed to simply $T.
 .TP
 .B \-u
-Set CDDBPROTOCOL to version 6, so that we retrieve UTF-8 encoded CDDB
+Set CDDBPROTO to version 6, so that we retrieve UTF-8 encoded CDDB
 information, and we tag and add comments with a proper encoding. This flag will
 be removed and -U will be added to set it to version 5 once version 6 becomes
 the default.
@@ -236,6 +237,10 @@ Python to stablish a conversation with the server for information retrieval.
 .B CDDBURL
 Specifies a server to use for CDDB lookups.
 .TP
+.B CDDBPROTO
+Specifies the protocol version used for the CDDB retrieval of results. Version
+6 retrieves CDDB entries in UTF-8 format.
+.TP
 .B HELLOINFO
 Specifies the Hello information to send to the CDDB server. The CDDB
 protocol requires you to send a valid username and hostname each time you
@@ -263,7 +268,7 @@ CDDB entry found in the local repository but which has been modified by the
 user; and "always" which forces the CDDB entry to be stored back in the root of
 the CDDBLOCALDIR no matter where it was found, and no matter it was not edited.
 This last option will always overwrite the one found in the root of the local
-repository (if any).
+repository (if any). STILL NOT WORKING!!
 .TP
 .B CDDBCOPYLOCAL
 Store local copies of the CDDB entries under the $CDDBLOCALDIR directory.