[Debburn-changes] r325 - nonameyet/trunk/cdda2wav
Eduard Bloch
blade at costa.debian.org
Fri Sep 22 07:32:25 UTC 2006
Author: blade
Date: 2006-09-22 07:32:24 +0000 (Fri, 22 Sep 2006)
New Revision: 325
Added:
nonameyet/trunk/cdda2wav/cdda2mp3.old
Removed:
nonameyet/trunk/cdda2wav/cdda2mp3
Modified:
nonameyet/trunk/cdda2wav/cdda2ogg
Log:
renamed cdda2mp3, will use a symlink soon
Deleted: nonameyet/trunk/cdda2wav/cdda2mp3
===================================================================
--- nonameyet/trunk/cdda2wav/cdda2mp3 2006-09-21 22:57:16 UTC (rev 324)
+++ nonameyet/trunk/cdda2wav/cdda2mp3 2006-09-22 07:32:24 UTC (rev 325)
@@ -1,68 +0,0 @@
-#! /bin/sh
-# Demo script for processing all audio tracks with a mp3 decoder
-# based on a news article by Tom Kludy
-# This variant uses named pipes in order to save space.
-# There is another variant of this script, which uses temporary
-# wav files (see cdda2mp3.new).
-#
-# usage: cdda2mp3 <name prefix for all mp3 files>
-#
-# list_audio_tracks is a (symbolic) link to cdda2wav
-# and used to generate a list of audio track numbers and start
-# sectors, which in turn are used in a loop to spawn cdda2wav
-# and the post processor on a track by track basis.
-
-# specify the sampling program and its options
-# do not specify the track option here!
-CDDA2WAV=${CDDA2WAV:-cdda2wav}
-CDDA2WAV_OPTS=${CDDA2WAV_OPTS:-'-H -P0 -q'}
-
-# for normal use, comment out the next line
-#DEBUG='-d1'
-
-# the post processor is fed through a pipe to avoid space waste
-# specify the post processing program and its options
-MP_CODER=${MP_CODER:-lame}
-MP_OPTIONS=${MP_OPTIONS:-''}
-
-export MP_CODER
-MP_CODER=$(which $MP_CODER 2>/dev/null)
-if [ ! -x "$MP_CODER" ] ; then
- echo "Encoder not found. Install one first!"
- exit 1
-fi
-
-CDDA_DEVICE=${CDDA_DEVICE:-/dev/cdrw}
-
-FILEPREFIX=${1:-audiotrack}
-
-if [ -e /etc/default/cdda2mp3 ]; then
- . /etc/default/cdda2mp3
-fi
-
-if [ -z "$LIST" ] ; then
- echo Looking for available tracks...
- LIST="$( cdda2wav -J -vtoc -H 2>&1 | sed -e 's/^[^\ ].*//; s/\.([^)]*)/ /g;s/,//g;')"
- if [ -z "$LIST" ] ; then
- echo "ERROR: No valid audio tracks detected"
- exit 1
- fi
-fi
-
-echo Fetching `echo $LIST | wc -w` tracks in $CDDA_DEVICE, encoding with $MP_CODER.
-echo Cancel with Ctrl-C, watch out for error messages.
-
-for TRACK in $LIST ; do
- NAME="`printf "%02d" $TRACK`-$FILEPREFIX.mp3"
- echo
- echo "############ Starting with Track Nr. $TRACK -> $NAME ############"
- $CDDA2WAV $CDDA2WAV_OPTS -t$TRACK $DEBUG - | \
- $MP_CODER $MP_OPTIONS - "$NAME"
- # check result code
- RES=$?
- if [ $RES != 0 ] ; then
- echo File $NAME failed \(result $RES\). Aborted. >&2
- break
- fi
-done
-
Copied: nonameyet/trunk/cdda2wav/cdda2mp3.old (from rev 323, nonameyet/trunk/cdda2wav/cdda2mp3)
===================================================================
--- nonameyet/trunk/cdda2wav/cdda2mp3.old (rev 0)
+++ nonameyet/trunk/cdda2wav/cdda2mp3.old 2006-09-22 07:32:24 UTC (rev 325)
@@ -0,0 +1,68 @@
+#! /bin/sh
+# Demo script for processing all audio tracks with a mp3 decoder
+# based on a news article by Tom Kludy
+# This variant uses named pipes in order to save space.
+# There is another variant of this script, which uses temporary
+# wav files (see cdda2mp3.new).
+#
+# usage: cdda2mp3 <name prefix for all mp3 files>
+#
+# list_audio_tracks is a (symbolic) link to cdda2wav
+# and used to generate a list of audio track numbers and start
+# sectors, which in turn are used in a loop to spawn cdda2wav
+# and the post processor on a track by track basis.
+
+# specify the sampling program and its options
+# do not specify the track option here!
+CDDA2WAV=${CDDA2WAV:-cdda2wav}
+CDDA2WAV_OPTS=${CDDA2WAV_OPTS:-'-H -P0 -q'}
+
+# for normal use, comment out the next line
+#DEBUG='-d1'
+
+# the post processor is fed through a pipe to avoid space waste
+# specify the post processing program and its options
+MP_CODER=${MP_CODER:-lame}
+MP_OPTIONS=${MP_OPTIONS:-''}
+
+export MP_CODER
+MP_CODER=$(which $MP_CODER 2>/dev/null)
+if [ ! -x "$MP_CODER" ] ; then
+ echo "Encoder not found. Install one first!"
+ exit 1
+fi
+
+CDDA_DEVICE=${CDDA_DEVICE:-/dev/cdrw}
+
+FILEPREFIX=${1:-audiotrack}
+
+if [ -e /etc/default/cdda2mp3 ]; then
+ . /etc/default/cdda2mp3
+fi
+
+if [ -z "$LIST" ] ; then
+ echo Looking for available tracks...
+ LIST="$( cdda2wav -J -vtoc -H 2>&1 | sed -e 's/^[^\ ].*//; s/\.([^)]*)/ /g;s/,//g;')"
+ if [ -z "$LIST" ] ; then
+ echo "ERROR: No valid audio tracks detected"
+ exit 1
+ fi
+fi
+
+echo Fetching `echo $LIST | wc -w` tracks in $CDDA_DEVICE, encoding with $MP_CODER.
+echo Cancel with Ctrl-C, watch out for error messages.
+
+for TRACK in $LIST ; do
+ NAME="`printf "%02d" $TRACK`-$FILEPREFIX.mp3"
+ echo
+ echo "############ Starting with Track Nr. $TRACK -> $NAME ############"
+ $CDDA2WAV $CDDA2WAV_OPTS -t$TRACK $DEBUG - | \
+ $MP_CODER $MP_OPTIONS - "$NAME"
+ # check result code
+ RES=$?
+ if [ $RES != 0 ] ; then
+ echo File $NAME failed \(result $RES\). Aborted. >&2
+ break
+ fi
+done
+
Modified: nonameyet/trunk/cdda2wav/cdda2ogg
===================================================================
--- nonameyet/trunk/cdda2wav/cdda2ogg 2006-09-21 22:57:16 UTC (rev 324)
+++ nonameyet/trunk/cdda2wav/cdda2ogg 2006-09-22 07:32:24 UTC (rev 325)
@@ -1,16 +1,8 @@
#! /bin/sh
-# Demo script for processing all audio tracks with a mp3 decoder
+# Script for processing all audio tracks with an ogg or mp3 decoder
# based on a news article by Tom Kludy
# This variant uses named pipes in order to save space.
-# There is another variant of this script, which uses temporary
-# wav files (see cdda2mp3.new).
-#
-# usage: cdda2ogg <name prefix for all ogg files>
-#
-# list_audio_tracks is a (symbolic) link to cdda2wav
-# and used to generate a list of audio track numbers and start
-# sectors, which in turn are used in a loop to spawn cdda2wav
-# and the post processor on a track by track basis.
+# usage: cdda2ogg <name prefix for all ogg/mp3 files>
# specify the sampling program and its options
# do not specify the track option here!
@@ -20,15 +12,37 @@
# for normal use, comment out the next line
#DEBUG='-d1'
+suffix=`basename $0 | cut -c6-` # suffix: ogg or mp3
+
# the post processor is fed through a pipe to avoid space waste
# specify the post processing program and its options
-MP_CODER=${MP_CODER:-oggenc}
+case "$suffix" in
+ ogg|OGG|Ogg)
+ # ensure the right suffix for suffixes later
+ suffix=ogg
+ missmsg="Encoder not found. Install one first! (eg. vorbis-tools)"
+ MP_CODER=${MP_CODER:-oggenc}
+ outopt="-o"
+ ;;
+ mp3|MP3|mpeg3|MPEG3|Mp3)
+ suffix=mp3
+ missmsg="Encoder not found. Install one first! (eg. lame)"
+ MP_CODER=${MP_CODER:-lame}
+ outopt=""
+ ;;
+ *)
+ echo Unknown target file type: $suffix. Valid names for this application are: cdda2mp3, cdda2ogg.
+ exit 1
+ ;;
+esac
+
MP_OPTIONS=${MP_OPTIONS:-''}
export MP_CODER
+
MP_CODER=$(which $MP_CODER 2>/dev/null)
if [ ! -x "$MP_CODER" ] ; then
- echo "Encoder not found. Install one first! (eg. vorbis-tools)"
+ echo $missmsg
exit 1
fi
@@ -37,12 +51,14 @@
FILEPREFIX=${1:-audiotrack}
-if [ -e /etc/default/cdda2ogg ]; then
- . /etc/default/cdda2ogg
+if [ -e /etc/default/cdda2$suffix ]; then
+ . /etc/default/cdda2$suffix
fi
if [ -z "$LIST" ] ; then
echo Looking for available tracks...
+ # could use list_audio_tracks instead but that would need an extra filter as
+ # well, and this way we do not depend on that symlink
LIST="$( cdda2wav -J -vtoc -H 2>&1 | sed -e 's/^[^\ ].*//; s/\.([^)]*)/ /g;s/,//g;')"
if [ -z "$LIST" ] ; then
echo "ERROR: No valid audio tracks detected"
@@ -54,11 +70,11 @@
echo Cancel with Ctrl-C, watch out for error messages.
for TRACK in $LIST ; do
- NAME="`printf "%02d" $TRACK`-$FILEPREFIX.ogg"
+ NAME="`printf "%02d" $TRACK`-$FILEPREFIX.$suffix"
echo
echo "############ Starting with Track Nr. $TRACK -> $NAME ############"
$CDDA2WAV $CDDA2WAV_OPTS -t$TRACK $DEBUG - | \
- $MP_CODER $MP_OPTIONS - > "$NAME"
+ $MP_CODER $MP_OPTIONS - $outopt "$NAME"
# check result code
RES=$?
More information about the Debburn-changes
mailing list