r174@frost: data | 2005-10-02 15:29:31 +0300
authordata <data@a0fa61bc-5347-0410-a1a9-7f54aa4e1825>
Sun, 2 Oct 2005 12:30:54 +0000 (12:30 +0000)
committerdata <data@a0fa61bc-5347-0410-a1a9-7f54aa4e1825>
Sun, 2 Oct 2005 12:30:54 +0000 (12:30 +0000)
 First steps to get a singletrack flac as a source for tracks

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

FAQ
README
abcde
abcde.1
abcde.conf
debian/changelog

diff --git a/FAQ b/FAQ
index 660be22..5530971 100644 (file)
--- a/FAQ
+++ b/FAQ
@@ -35,6 +35,13 @@ A. When it is ready. I keep on having new ideas and adding them to the trunk
 2. EXECUTION
    =========
 
+Q. I want to force abcde 2.x to behave more like 1.x. How do I do it?
+A. Put these options in your abcde.conf:
+
+   INTERACTIVE=n
+   OUTPUTTYPE=mp3
+   ID3TAGV=1
+
 Q. Low on disk space?
 A. abcde has different algorithms to schedule ripping and encoding - to 
    optimize for disk conservation, use -l. You can also define
diff --git a/README b/README
index 4c7c8f3..7744e94 100644 (file)
--- a/README
+++ b/README
@@ -2,8 +2,9 @@ ABCDE
 =====
 
 abcde is a frontend command-line utility (actually, a shell script) that
-grabs tracks off a CD, encodes them to Ogg/Vorbis, MP3, FLAC, Ogg/Speex and/or
-MPP/MP+(Musepack) format, and tags them, all in one go.
+grabs tracks off a CD or a singletrack flac file with an embeded cuesheet,
+encodes them to Ogg/Vorbis, MP3, FLAC, Ogg/Speex and/or MPP/MP+(Musepack)
+format, and tags them, all in one go.
 
 Your finished Ogg/MP3/FLAC/Speex/MPP's are, by default, stored in a subdirectory
 of the current directory (named after the artist) with a filename based on the
@@ -15,13 +16,7 @@ abcde.conf to change it.
 
 Many of the questions related of problems executing abcde have been moved to the
 FAQ, which should be distributed along with this package. Reffer to that file 
-for help.
-
-To make abcde 2.x work more like 1.x, put these options in your abcde.conf:
-
-INTERACTIVE=n
-OUTPUTTYPE=mp3
-ID3TAGV=1
+for more help.
 
 MAJOR CHANGES
 =============
@@ -31,7 +26,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 using a singletrack flac file with an embeded
+  cuesheet as a source to extract tracks from.
 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
diff --git a/abcde b/abcde
index d03e009..0bb6d3b 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -28,7 +28,7 @@ echo "       Specify a configuration file (overrides system and user config file
 echo "-C <discid#>"
 echo "       Specify discid to resume from (only needed if you no longer have the cd)"
 echo "-d <device>"
-echo "       Specify CDROM device to grab"
+echo "       Specify CDROM device to grab (flac uses a single-track flac file)"
 echo "-D     Debugging mode (equivalent to sh -x abcde)"
 echo "-e     Erase encoded track information from status file"
 #echo "-E     Set the encoding information for the tags"
@@ -321,7 +321,7 @@ do_gettracknum()
 do_replaygain()
 {
        if checkstatus replaygain; then :; else
-               run_command "" echo "Adding reply-gain information..."
+               run_command "" echo "Adding replygain information..."
                for OUTPUT in $( echo $OUTPUTTYPE | tr , \ )
                # THE OUTPUT NEEDS TO BE CORRECTED WITH THE CONTAINER?
                do
@@ -1248,11 +1248,21 @@ do_discid ()
                if [ "$OSFLAVOUR" = "OSX" ]; then
                        disktool -u ${CDROM#/dev/}
                fi
-               TRACKINFO=$($CDDISCID $CDROM)
+               if [ "$CDROMREADERSYNTAX" = "flac" ] ; then
+                       TRACKINFO=$($METAFLAC $METAFLACOPTS --export-cuesheet-to=- $CDROM | $CUE2DISCID)
+               else
+                       TRACKINFO=$($CDDISCID $CDROM)
+               fi
                # Make sure there's a CD in there by checking cd-discid's return code
-               if [ "$?" = "1" ]; then
-                       echo "abcde error: CD could not be read. Perhaps there's no CD in the drive?" >&2
-                       exit 1
+               if [ ! "$?" = "0" ]; then
+                       if [ "$CDROMREADERSYNTAX" = "flac" ] ; then
+                               echo "abcde error: cuesheet information from the flac file could not be read." >&2
+                               echo "abcde error: Perhaps the flac file does not contain a cuesheet?." >&2
+                               exit 1
+                       else
+                               echo "abcde error: CD could not be read. Perhaps there's no CD in the drive?" >&2
+                               exit 1
+                       fi
                fi
                # In OSX, remount the disc again
                if [ "$OSFLAVOUR" = "OSX" ]; then
@@ -2043,6 +2053,8 @@ do_cdread ()
                LASTTRACK=$3
                UTRACKNUM=$FIRSTTRACK
                case "$CDROMREADERSYNTAX" in
+                       ### FIXME ### How are we calculating the tracks in flac mode?
+                       flac) READTRACKNUMS="$FIRSTTRACK.1-$(($LASTTRACK + 1)).0" ;;
                        cdparanoia) READTRACKNUMS="$FIRSTTRACK-$LASTTRACK" ;;
                        cdda2wav) READTRACKNUMS="$FIRSTTRACK+$LASTRACK" ;;
                        *) echo "abcde error: $CDROMREADERSYNTAX does not support ONETRACK mode"
@@ -2060,7 +2072,10 @@ do_cdread ()
        else
                WAVDATA="$ABCDETEMPDIR/track$UTRACKNUM.wav"
                case "$CDROMREADERSYNTAX" in
-               ## FIXME ## Find the case for dagrab, to avoid exceptions
+               ## FIXME ## Find the cases for dagrab and flac, to avoid exceptions
+                       flac)
+                               FILEARG="--output-name=$WAVDATA"
+                               ;;
                        dagrab)
                                FILEARG="-f $WAVDATA"
                                ;;
@@ -2082,6 +2097,10 @@ do_cdread ()
                fi
        fi
        case "$CDROMREADERSYNTAX" in
+               ### FIXME ### use an exception for flac, since it uses -o
+               ### FIXME ### Shall we just use -o $FILEARG ??
+               flac)
+                       nice $READNICE $FLAC -d --cue=${READTRACKNUMS:-$UTRACKNUM.1-$(($UTRACKNUM + 1)).0} "$FILEARG" "$CDROM" ;;
                cdparanoia) 
                        nice $READNICE $CDROMREADER -$CDPARANOIACDROMBUS $CDROM ${READTRACKNUMS:-$UTRACKNUM} "$FILEARG" $REDIR ;;
                cdda2wav)
@@ -2291,6 +2310,7 @@ VORBISGAIN=vorbisgain
 MKCUE=mkcue
 MKTOC=cdrdao
 DIFF=diff
+CUE2DISCID=cue2discid
 
 # Options for programs called from abcde
 # mp3
@@ -2415,7 +2435,7 @@ fi
 
 # Parse command line options
 #while getopts 1a:A:bc:C:d:Dehj:klLmMnNo:pPr:Rs:S:t:T:vVxw:W: opt ; do
-while getopts 1a:bc:C:d:Dehj:klLmMnNo:pPr:Rs:S:t:T:vVxw:W: opt ; do
+while getopts 1a:bc:C:d:Dehj:klLmMnNo:pPr:Rs:S:t:T:vVxw:W:z opt ; do
        case "$opt" in
                1) ONETRACK=y ;;
                a) ACTIONS="$OPTARG" ;;
@@ -2467,16 +2487,28 @@ while getopts 1a:bc:C:d:Dehj:klLmMnNo:pPr:Rs:S:t:T:vVxw:W: opt ; do
                         exit 1
                   fi
                   ;;
+               z) echo "Placeholder for a future autodebug option" ;;
                ?) usage; exit ;;
        esac
 done
 
 shift $(($OPTIND - 1))
 
+# If the user specified a flac file, then switch to special flac mode
+if echo $CDROM | grep -i -q '.flac$'; then
+       vecho "abcde: switching to flac CDROMREADERSYNTAX..."
+       CDROMREADERSYNTAX=flac
+       if [ "$EJECTCD" = "y" ];then
+               vecho "abcde: CDROM flac mode, deactivating EJECTCD..."
+               EJECTCD=n
+       fi
+fi
+
 # Decide if we can continue.
 if [ "$ONETRACK" = "y" ]; then 
        # FIXME # remove check as soon as we find out about the other readers
        case "$CDROMREADERSYNTAX" in
+               flac) ;;
                cdparanoia) ;;
                cdda2wav) ;;
                *) echo "abcde error: $CDROMREADERSYNTAX does not support ONETRACK mode"
@@ -2637,6 +2669,10 @@ case "$CDROMREADERSYNTAX" in
                CDROMREADER="$CDDAFS"
                CDROMREADEROPTS="$CDDAFSOPTS"
                ;;
+       flac)
+               CDROMREADER="$FLAC"
+               CDROMREADEROPTS="$FLACOPTS"
+               ;;
 esac
 
 # There's only one normalize...
@@ -2683,6 +2719,7 @@ do
                        ;;
                flac)
                        [ "$FLACENCODERSYNTAX" = "default" ] && FLACENCODERSYNTAX=flac
+                       [ "$REPLAYGAIN" = "y" ] && NEEDMETAFLAC=y
                        [ "$DOTAG" = "y" ] && NEEDMETAFLAC=y
                        ;;
                spx)
@@ -2822,6 +2859,8 @@ fi
 if [ X"$CDSPEEDVALUE" != "X" ]; then
        case "$CDROMREADERSYNTAX" in
                cdparanoia|debug) CDROMREADEROPTS="$CDPARANOIAOPTS -S $CDSPEEDVALUE" ;;
+               ### FIXME ### translate "cue2discid" from python to bash
+               flac) NEEDMETAFLAC=y ; NEEDCUE2DISCID=y ;;
                *) NEEDCDSPEED=y ;;
        esac
 fi
@@ -2829,6 +2868,7 @@ fi
 # Rippers with USEPIPE support
 # FIXME # Include here all the rippers we can figure out support pipes
 PIPE_cdparanoia="-"
+PIPE_flac="-c "
 
 # Encoders with USEPIPE support
 # FIXME # Include here all the encoders we can figure out support pipes
@@ -2873,7 +2913,8 @@ for X in $CDROMREADER $CDDISCID ${NEEDTAGGER+$TAGGER} $MP3ENCODER \
        ${NEEDCOMMENTER+$VORBISCOMMENT} ${NEEDMETAFLAC+$METAFLAC} \
        ${NEEDNORMALIZER+$NORMALIZER} ${NEEDEJECT+$EJECT} \
        ${NEEDDISKTOOL+disktool} ${NEEDCDSPEED+$CDSPEED} \
-       ${NEEDVORBISGAIN+$VORBISGAIN} ${NEEDCUEREADER+$CUEREADER}
+       ${NEEDVORBISGAIN+$VORBISGAIN} ${NEEDCUEREADER+$CUEREADER} \
+       ${NEEDCUE2DISCID+$CUE2DISCID}
 do
        # Cut off the command-line options we just added in
        X=$(echo $X | cut -d' ' -f2)
@@ -2937,7 +2978,8 @@ fi
 
 if [ X"$CDSPEEDVALUE" != "X" ]; then
        case "$CDROMREADERSYNTAX" in
-               cdparanoia|debug) : ;;
+               cdparanoia|debug) ;;
+               flac) ;;
                *) do_cdspeed ;;
        esac
 fi
@@ -3239,7 +3281,7 @@ if [ "$DOENCODE" = "y" -a "$USEPIPES" != "y" ]; then
 fi
 # If the above didn't catch the stragglers, this will
 wait
-if [ "$DOREPLAYGAIN" = "y" ]; then
+if [ "$REPLAYGAIN" = "y" ]; then
        do_replaygain
 fi
 # Check to see if run_command logged any errors
diff --git a/abcde.1 b/abcde.1
index 85831f3..73a26ed 100644 (file)
--- a/abcde.1
+++ b/abcde.1
@@ -36,7 +36,8 @@ Repeat until finished
 .TP
 .B \-1
 Encode the whole CD in a single file. The resulting file uses the CD title
-for tagging.
+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
 .B \-a [actions]
 Comma-delimited list of actions to perform. Can be one or more of:
@@ -59,8 +60,9 @@ when you no longer have the CD available (abcde will automatically resume if
 you still have the CD in the drive). You must have already finished at
 least the "read" action during the previous session.
 .TP
-.B \-d [devicename]
-CD\-ROM block device that contains audio tracks to be read.
+.B \-d [devicename | filename]
+CD\-ROM block device that contains audio tracks to be read. Alternatively, a
+single-track flac file with embeded cuesheet.
 .TP
 .B \-D
 Capture debugging information (you'll want to redirect this \- try 'abcde \-D
@@ -97,6 +99,8 @@ endings. Some hardware players insist on having those to work.
 .B \-M
 Create a CUE file with information about the CD. Together with the possibility
 of creating a single file (see option "\-1"), one can recreate the original CD.
+If the cuesheet is embeded in a flac single file it can be used as source for
+encoding other formats.
 .TP
 .B \-o [filetype][:filetypeoptions]
 Select output type. Can be "vorbis" (or "ogg"), "mp3", "flac", "spx" or "mpc".
@@ -114,7 +118,7 @@ the REMOTEHOSTS configuration variable.
 .TP
 .B \-R
 Add replaygain information to the id3 or tag information for play
-normalization. Only works with MP3 and Ogg/Vorbis.
+normalization. Only works with Ogg/FLAC and Ogg/Vorbis.
 .TP
 .B \-s [fields...]
 List, separated by comas, the fields to be shown in the CDDB parsed entries.
@@ -235,9 +239,10 @@ and \'normalize'\ (and both run \'normalize-audio\'), since we only support it,
 ATM.
 .TP
 .B CDROMREADERSYNTAX
-Specifies the style of cdrom reader to use. Valid options are \'cdparanoia\'
-and \'debug\'. It is used for querying the CDROM and obtain a list of valid
-tracks and DATA tracks. Right now, only cdparanoia is supported.
+Specifies the style of cdrom reader to use. Valid options are \'cdparanoia\',
+\'debug\' and \'flac\'. It is used for querying the CDROM and obtain a list of
+valid tracks and DATA tracks. The special \'flac\' case is used to "rip" CD
+tracks from a single-track flac file.
 .TP
 .B CUEREADERSYNTAX
 Specifies the syntax of the program we use to read the CD CUE sheet. Right now
@@ -286,7 +291,8 @@ The default actions to be performed when reading a disc.
 .TP
 .B CDROM
 If set, it points to the CD-Rom device which has to be used for audio
-extraction. Abcde tries to guess the right device, but it may fail.
+extraction. Abcde tries to guess the right device, but it may fail. The special
+\'flac\' option is defined to extract tracks from a single-track flac file.
 .TP
 .B CDPARANOIACDROMBUS
 Defined as "d" when using cdparanoia with an IDE bus and as "g" when using
@@ -402,7 +408,8 @@ The default function is empty.
 .TP
 .B EJECTCD
 If set to "y", abcde will call eject(1) to eject the cdrom from the drive
-after all tracks have been read.
+after all tracks have been read. It has no effect when CDROM is set to a flac
+file.
 .TP
 .B EXTRAVERBOSE
 If set to "y", some operations which are usually now shown to the end user
@@ -425,8 +432,12 @@ Will pass "-b 192" to the Ogg/Vorbis encoder, without having to modify the
 config file
 .TP
 .B abcde -W 1
-For double CDs settings: will create the 1st CD starting with the track number
-101, and will add a comment "CD 1" to the tracks
+For double+ CD settings: will create the 1st CD starting with the track number
+101, and will add a comment "CD 1" to the tracks, the second starting with 201
+and so on.
+.TP
+.B abcde \-d singletrack.flac
+Will extract the files contained in singletrack using the embeded cuesheet.
 .SH BACKEND TOOLS
 abcde requires the following backend tools to work:
 .TP
@@ -450,6 +461,9 @@ An HTTP retrieval program: wget, fetch (FreeBSD) or curl (Mac OS X, among others
 .TP
 .B *
 (optional) normalize, a WAV file volume normalizer.
+.TP
+.B *
+(optional) mkcue, a CD cuesheet extractor.
 .SH "SEE ALSO"
 .BR cdparanoia (1),
 .BR cdda2wav (1),
@@ -458,15 +472,16 @@ An HTTP retrieval program: wget, fetch (FreeBSD) or curl (Mac OS X, among others
 .BR oggenc (1),
 .BR vorbize (1),
 .BR flac (1),
-.BR speexenc(1),
-.BR mppenc(1),
+.BR speexenc (1),
+.BR mppenc (1),
 .BR id3 (1),
 .BR wget (1),
 .BR fetch (1),
 .BR cd-discid (1),
 .BR distmp3 (1),
 .BR distmp3host (1),
-.BR curl(1)
+.BR curl (1)
+.BR mkcue (1),
 .SH AUTHORS
 Robert Woodcock <rcw@debian.org>,
 Jesus Climent <jesus.climent@hispalinux.es> and contributions from many others.
index f4708db..cae224c 100644 (file)
@@ -68,7 +68,7 @@
 #NORMALIZERSYNTAX=default
 
 # CD reader program to use - currently recognized options are 'cdparanoia',
-# 'cdda2wav', 'dagrab' and 'cddafs' (Mac OS X only).
+# 'cdda2wav', 'dagrab', 'cddafs' (Mac OS X only) and 'flac'.
 #CDROMREADERSYNTAX=cdparanoia
 
 # CUE reader program to use.
 #ACTIONS=cddb,read,encode,tag,move,clean
 
 # CD device you want to read from
+# It can be defined as a singletrack flac file, but since it might change from
+# file to file it makes little sense to define it here.
 #CDROM=/dev/cdrom
 # If we are using the IDE bus, we need CDPARANOIACDROMBUS defined as "d"
 # If we are using the ide-scsi emulation layer, we need to define a "g"
index fd04fa4..eb17a37 100644 (file)
@@ -4,8 +4,10 @@ abcde (2.3.99-1) unstable; urgency=low
   * Added SHOWCDDBFIELDS to allow the user to show YEAR and GENRE in the
     parsed CDDB output.
   * Changed cdparanoia-audio-tracks to use the status file to save the data.
+  * Added the possibility of using a singletrack flac file with an embeded
+    cuesheet as a source of tracks.
 
- -- Jesus Climent <jesus.climent@hispalinux.es>  Sat,  3 Sep 2005 19:26:44 +0300
+ -- Jesus Climent <jesus.climent@hispalinux.es>  Sat,  1 Oct 2005 14:44:03 +0300
 
 abcde (2.3.4-1) unstable; urgency=low