[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[abcde] Bug#148934: abcde: Dirty patch for ogg+mp3 encoding148934@bugs.debian.org
Package: abcde
Version: 2.0.3-1
Followup-For: Bug #148934
Tags: patch
Still there is some more work to do, but I have a working patch for
ogg+mp3 creation from the same CD, without having to rip twice.
Right now, the both file formats are stored in the same dir, but I will
separate them.
Check it out and send bug reports.
The "OUTPUTTYPE" variable has to be taken out from the
OUTPUTFORMAT='${ARTISTFILE}/${TRACKFILE}.$OUTPUTTYPE'
variable, to be able to handle the extensions, so remember doing so if
you have personalised your /etc/abcde.conf
And no, the playlists do not work. Not yet.
And no, the distributed coding do not work. Not yet.
mooch
-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux pumuki 2.4.19-ck10 #2 SMP Tue Oct 29 18:25:58 EET 2002 i686
Locale: LANG=C, LC_CTYPE=C
Versions of packages abcde depends on:
ii cd-discid 0.7-1 CDDB DiscID utility
ii cdda2wav 4:1.10+11a39-2 Creates WAV files from audio CDs
ii cdparanoia 3a9.8-7 An audio extraction tool for sampl
ii vorbis-tools 1.0.0-1 Several Ogg Vorbis Tools
ii wget 1.8.2-5 retrieves files from the web
-- no debconf information
diff
--- abcde.orig 2002-01-28 07:56:51.000000000 +0200
+++ abcde 2002-11-27 17:08:56.000000000 +0200
@@ -221,85 +221,97 @@
{
COMMENTOUTPUT="$(eval echo ${COMMENT})"
run_command '' echo "Tagging track $1 of $TRACKS: $TRACKNAME..."
- if [ "$OUTPUTTYPE" = "mp3" ]; then
- # Amazingly, id3 and id3v2 have identical -a, -A, -c, -t, and -T switches
- # ...except id3v2's -c is completely broken (there's a bug in id3lib
- # v3.7.x keeping -c from being properly implemented)
- if [ "$ID3TAGV" = "2" ]; then
- run_command tagtrack-$1 $TAGGER $TAGGEROPTS -A "$DALBUM" -a "$TRACKARTIST" \
- -t "$TRACKNAME" -T "$1" "$ABCDETEMPDIR/track$1.$OUTPUTTYPE"
- else
- run_command tagtrack-$1 $TAGGER $TAGGEROPTS -c "$COMMENTOUTPUT" \
- -A "$DALBUM" -a "$TRACKARTIST" -t "$TRACKNAME" -T "$1" "$ABCDETEMPDIR/track$1.$OUTPUTTYPE"
- fi
- else
- # vorbiscomment can't do in-place modification, mv the file first
- if [ -f "$ABCDETEMPDIR/track$1.$OUTPUTTYPE" -a ! -f "$ABCDETEMPDIR/track$1.uncommented.$OUTPUTTYPE" ]; then
- mv "$ABCDETEMPDIR/track$1.$OUTPUTTYPE" "$ABCDETEMPDIR/track$1.uncommented.$OUTPUTTYPE"
- fi
- (
- # These are from http://www.xiph.org/ogg/vorbis/doc/v-comment.html
- echo ARTIST=$TRACKARTIST
- echo ALBUM=$DALBUM
- echo TITLE=$TRACKNAME
- echo TRACKNUMBER=$1
- if [ "$(eval echo ${COMMENT})" != "" ]; then
- echo $DESCRIPTION=$COMMENTOUTPUT;
- fi
- ) | run_command tagtrack-$1 $VORBISCOMMENT -w \
- "$ABCDETEMPDIR/track$1.uncommented.$OUTPUTTYPE" "$ABCDETEMPDIR/track$1.$OUTPUTTYPE"
- # Doublecheck that the commented file was created successfully before wiping the original
- if [ -f "$ABCDETEMPDIR/track$1.$OUTPUTTYPE" ]; then
- rm -f "$ABCDETEMPDIR/track$1.uncommented.$OUTPUTTYPE"
- else
- mv "$ABCDETEMPDIR/track$1.uncommented.$OUTPUTTYPE" "$ABCDETEMPDIR/track$1.$OUTPUTTYPE"
- fi
- fi
+ for OUTPUT in $(echo $OUTPUTTYPE | tr , \ )
+ do
+ case "$OUTPUT" in
+ mp3)
+ # Amazingly, id3 and id3v2 have identical -a, -A, -c, -t, and -T switches
+ # ...except id3v2's -c is completely broken (there's a bug in id3lib
+ # v3.7.x keeping -c from being properly implemented)
+ if [ "$ID3TAGV" = "2" ]; then
+ run_command tagtrack-$1 $TAGGER $TAGGEROPTS -A "$DALBUM" -a "$TRACKARTIST" \
+ -t "$TRACKNAME" -T "$1" "$ABCDETEMPDIR/track$1.$OUTPUT"
+ else
+ run_command tagtrack-$1 $TAGGER $TAGGEROPTS -c "$COMMENTOUTPUT" \
+ -A "$DALBUM" -a "$TRACKARTIST" -t "$TRACKNAME" -T "$1" "$ABCDETEMPDIR/track$1.$OUTPUT"
+ fi
+ ;;
+ ogg)
+ # vorbiscomment can't do in-place modification, mv the file first
+ if [ -f "$ABCDETEMPDIR/track$1.$OUTPUT" -a ! -f "$ABCDETEMPDIR/track$1.uncommented.$OUTPUT" ]; then
+ mv "$ABCDETEMPDIR/track$1.$OUTPUT" "$ABCDETEMPDIR/track$1.uncommented.$OUTPUT"
+ fi
+ (
+ # These are from http://www.xiph.org/ogg/vorbis/doc/v-comment.html
+ echo ARTIST=$TRACKARTIST
+ echo ALBUM=$DALBUM
+ echo TITLE=$TRACKNAME
+ echo TRACKNUMBER=$1
+ if [ "$(eval echo ${COMMENT})" != "" ]; then
+ echo $DESCRIPTION=$COMMENTOUTPUT;
+ fi
+ ) | run_command tagtrack-$1 $VORBISCOMMENT -w \
+ "$ABCDETEMPDIR/track$1.uncommented.$OUTPUT" "$ABCDETEMPDIR/track$1.$OUTPUT"
+ # Doublecheck that the commented file was created successfully before wiping the original
+ if [ -f "$ABCDETEMPDIR/track$1.$OUTPUT" ]; then
+ rm -f "$ABCDETEMPDIR/track$1.uncommented.$OUTPUT"
+ else
+ mv "$ABCDETEMPDIR/track$1.uncommented.$OUTPUT" "$ABCDETEMPDIR/track$1.$OUTPUT"
+ fi
+ ;;
+ esac
+ done
}
-# do_encode [tracknumber] [hostname]
+# do_encode [tracknumber] [hostname] [outputtype]
# If no hostname is specified, encode locally
# variables used:
# TRACKS, TRACKNAME, TRACKARTIST, DISTMP3, DISTMP3OPTS, ENCODERSYNTAX, OUTPUTTYPE, ENCODEROPTS, DALBUM, DARTIST, ENCNICE
do_encode ()
{
+ OUTPUT=$3
IN="$ABCDETEMPDIR/track$1.wav"
- OUT="$ABCDETEMPDIR/track$1.$OUTPUTTYPE"
+ OUT="$ABCDETEMPDIR/track$1.$OUTPUT"
run_command '' echo "Encoding track $1 of $TRACKS: $TRACKNAME..."
- case "$OUTPUTTYPE" in
+# echo $@
+# echo $OUTPUT
+# echo $ENCODERSYNTAX
+# echo $ENCODERSYNTAXMP3
+# echo $ENCODERSYNTAXOGG
+ case "$3" in
mp3)
case "$2" in
%local*%)
- case "$ENCODERSYNTAX" in
- lame|gogo) run_command encodetrack-$1 nice $ENCNICE $ENCODER $ENCODEROPTS "$IN" "$OUT" ;;
- bladeenc) run_command encodetrack-$1 nice $ENCNICE $ENCODER $ENCODEROPTS -quit "$IN" ;;
- l3enc|xingmp3enc) run_command encodetrack-$1 nice $ENCNICE $ENCODER "$IN" "$OUT" $ENCODEROPTS ;;
- mp3enc) run_command encodetrack-$1 nice $ENCNICE $ENCODER -if "$IN" -of "$OUT" $ENCODEROPTS ;;
+ case "$ENCODERSYNTAXMP3" in
+ lame|gogo) run_command encodetrack-$OUTPUT-$1 nice $ENCNICE $ENCODERMP3 $ENCODEROPTSMP3 "$IN" "$OUT" ;;
+ bladeenc) run_command encodetrack-$OUTPUT-$1 nice $ENCNICE $ENCODERMP3 $ENCODEROPTSMP3 -quit "$IN" ;;
+ l3enc|xingmp3enc) run_command encodetrack-$OUTPUT-$1 nice $ENCNICE $ENCODERMP3 "$IN" "$OUT" $ENCODEROPTSMP3 ;;
+ mp3enc) run_command encodetrack-$OUTPUT-$1 nice $ENCNICE $ENCODERMP3 -if "$IN" -of "$OUT" $ENCODEROPTSMP3 ;;
esac
;;
- *)
- run_command encodetrack-$1 $DISTMP3 $DISTMP3OPTS "$2" "$IN" "$OUT" >/dev/null 2>&1
- ;;
+# *)
+# run_command encodetrack-$1 $DISTMP3 $DISTMP3OPTSMP3 "$2" "$IN" "$OUT" >/dev/null 2>&1
+# ;;
esac
;;
ogg)
case "$2" in
%local*%)
- case "$ENCODERSYNTAX" in
- vorbize) run_command encodetrack-$1 nice $ENCNICE $ENCODER $ENCODEROPTS -w "$OUT" "$IN" ;;
- oggenc) run_command encodetrack-$1 nice $ENCNICE $ENCODER $ENCODEROPTS -o "$OUT" "$IN" ;;
+ case "$ENCODERSYNTAXOGG" in
+ vorbize) run_command encodetrack-$OUTPUT-$1 nice $ENCNICE $ENCODEROGG $ENCODEROPTSOGG -w "$OUT" "$IN" ;;
+ oggenc) run_command encodetrack-$OUTPUT-$1 nice $ENCNICE $ENCODEROGG $ENCODEROPTSOGG -o "$OUT" "$IN" ;;
esac
;;
- *)
- run_command encodetrack-$1 $DISTMP3 $DISTMP3OPTS "$2" "$IN" "$OUT" >/dev/null 2>&1
- ;;
+# *)
+# run_command encodetrack-$1 $DISTMP3 $DISTMP3OPTS "$2" "$IN" "$OUT" >/dev/null 2>&1
+# ;;
esac
;;
esac
# Only remove .wav if the encoding succeeded
- if checkerrors encodetrack-$1; then :; else
- rm -f "$IN"
- fi
+# if checkerrors encodetrack-$OUTPUTTYPE-$1; then :; else
+# rm -f "$IN"
+# fi
}
# do_move [tracknumber]
@@ -330,7 +342,10 @@
OUTPUTFILEDIR=$(dirname "$OUTPUTDIR/$OUTPUTFILE")
# mkdir -p shouldn't return an error if the directory already exists
mkdir -p "$OUTPUTFILEDIR"
- run_command movetrack-$1 mv "$ABCDETEMPDIR/track$1.$OUTPUTTYPE" "$OUTPUTDIR/$OUTPUTFILE"
+ for OUTPUT in $(echo $OUTPUTTYPE | tr , \ )
+ do
+ run_command movetrack-$1 mv "$ABCDETEMPDIR/track$1.$OUTPUT" "$OUTPUTDIR/$OUTPUTFILE.$OUTPUT"
+ done
}
# do_playlist
@@ -514,6 +529,7 @@
clean) DOCLEAN=y;;
esac
done
+
}
# do_cddbquery
@@ -889,7 +905,8 @@
CDROMREADERSYNTAX=cdparanoia
OUTPUTTYPE=ogg
ENCODERSYNTAX=default
-OUTPUTFORMAT='${ARTISTFILE}/${TRACKFILE}.$OUTPUTTYPE'
+#OUTPUTFORMAT='${ARTISTFILE}/${TRACKFILE}.$OUTPUTTYPE'
+OUTPUTFORMAT='${ARTISTFILE}/${TRACKFILE}'
VAOUTPUTFORMAT=${OUTPUTFORMAT}
PLAYLISTFORMAT='${ARTISTFILE}_-_${ALBUMFILE}.m3u'
PLAYLISTDATAPREFIX=''
@@ -1029,48 +1046,65 @@
;;
esac
+# Determine what formats we want the output in, using the $OUTPUTTYPE
+# variable, and setting the following:
+OUTPUTTYPEMP3=n
+OUTPUTTYPEOGG=n
+for OUTPUTTYPES in $(echo $OUTPUTTYPE | tr , \ )
+do
+ case $OUTPUTTYPES in
+ mp3) OUTPUTTYPEMP3=y;;
+ ogg) OUTPUTTYPEOGG=y;;
+ esac
+done
+
# If nothing has been specified, use oggenc for oggs and lame for mp3s
if [ "$ENCODERSYNTAX" = "default" ]; then
- if [ "$OUTPUTTYPE" = "ogg" ]; then
- ENCODERSYNTAX=oggenc
- else
- ENCODERSYNTAX=lame
+ if [ "$OUTPUTTYPEOGG" = "y" ]; then
+ ENCODERSYNTAXOGG=oggenc
+ fi
+ if [ "$OUTPUTTYPEMP3" = "y" ]; then
+ ENCODERSYNTAXMP3=lame
fi
fi
-# decide which encoder
-case "$ENCODERSYNTAX" in
+# decide which encoder for mp3
+case "$ENCODERSYNTAXMP3" in
lame)
- ENCODEROPTS="$LAMEOPTS"
- ENCODER="$LAME"
+ ENCODEROPTSMP3="$LAMEOPTS"
+ ENCODERMP3="$LAME"
;;
gogo)
- ENCODEROPTS="$GOGOOPTS"
- ENCODER="$GOGO"
+ ENCODEROPTSMP3="$GOGOOPTS"
+ ENCODERMP3="$GOGO"
;;
bladeenc)
- ENCODEROPTS="$BLADEENCOPTS"
- ENCODER="$BLADEENC"
+ ENCODEROPTSMP3="$BLADEENCOPTS"
+ ENCODERMP3="$BLADEENC"
;;
l3enc)
- ENCODEROPTS="$L3ENCOPTS"
- ENCODER="$L3ENC"
+ ENCODEROPTSMP3="$L3ENCOPTS"
+ ENCODERMP3="$L3ENC"
;;
xingmp3enc)
- ENCODEROPTS="$XINGMP3ENCOPTS"
- ENCODER="$XINGMP3ENC"
+ ENCODEROPTSMP3="$XINGMP3ENCOPTS"
+ ENCODERMP3="$XINGMP3ENC"
;;
mp3enc)
- ENCODEROPTS="$MP3ENCOPTS"
- ENCODER="$MP3ENC"
+ ENCODEROPTSMP3="$MP3ENCOPTS"
+ ENCODERMP3="$MP3ENC"
;;
+esac
+
+# decide which encoder for ogg
+case "$ENCODERSYNTAXOGG" in
vorbize)
- ENCODEROPTS="$VORBIZEOPTS"
- ENCODER="$VORBIZE"
+ ENCODEROPTSOGG="$VORBIZEOPTS"
+ ENCODEROGG="$VORBIZE"
;;
oggenc)
- ENCODEROPTS="$OGGENCOPTS"
- ENCODER="$OGGENC"
+ ENCODEROPTSOGG="$OGGENCOPTS"
+ ENCODEROGG="$OGGENC"
;;
esac
@@ -1096,11 +1130,11 @@
# Don't check for stuff if it's not needed
if [ "$REMOTEHOSTS" ]; then NEEDDISTMP3=y; fi
-if [ "$OUTPUTTYPE" = "mp3" ]; then NEEDTAGGER=y; fi
-if [ "$OUTPUTTYPE" = "ogg" ]; then NEEDCOMMENTER=y; fi
+if [ "$OUTPUTTYPEMP3" = "y" ]; then NEEDTAGGER=y; fi
+if [ "$OUTPUTTYPEOGG" = "y" ]; then NEEDCOMMENTER=y; fi
# Make sure a buncha things exist
-for X in $CDROMREADER $CDDISCID ${NEEDTAGGER+$TAGGER} $ENCODER $WGET \
+for X in $CDROMREADER $CDDISCID ${NEEDTAGGER+$TAGGER} $ENCODERMP3 $ENCODEROGG $WGET \
${NEEDDISTMP3+$DISTMP3} ${NEEDCOMMENTER+$VORBISCOMMENT} seq
do
# Cut off the command-line options we just added in
@@ -1255,7 +1289,11 @@
(
if [ "$DOENCODE" = "y" ]; then
if checkstatus readtrack-$UTRACKNUM; then
- if checkstatus encodetrack-$UTRACKNUM; then :; else do_encode $UTRACKNUM $LOCATION; fi
+ for OUTPUT in $(echo $OUTPUTTYPE | tr , \ )
+ do
+ if checkstatus encodetrack-$OUTPUT-$UTRACKNUM; then :; else do_encode $UTRACKNUM $LOCATION $OUTPUT ; fi
+ done
+ echo encodetrack-$UTRACKNUM >> "$ABCDETEMPDIR/status"
fi
fi
if [ "$DOTAG" = "y" ]; then
@@ -1281,8 +1319,20 @@
do
CHECKTRACK="$(checkstatus encodetracklocation-$LOCATION)"
# "How can he give us a status update, if he's DEAD?"
- if checkstatus encodetrack-$CHECKTRACK; then
- continue
+ if [ $OUTPUTTYPEMP3 = "y" -a $OUTPUTTYPEOGG = "n" ] ; then
+ if checkstatus encodetrack-mp3-$CHECKTRACK; then
+ continue
+ fi
+ elif [ $OUTPUTTYPEOGG = "y" -a $OUTPUTTYPEMP3 = "n" ] ; then
+ if checkstatus encodetrack-ogg-$CHECKTRACK; then
+ continue
+ fi
+ else
+ if checkstatus encodetrack-ogg-$CHECKTRACK; then
+ if checkstatus encodetrack-mp3-$CHECKTRACK; then
+ continue
+ fi
+ fi
fi
# Nothing to see here please go quietly back to your homes
if [ -z "$CHECKTRACK" ]; then continue; fi
To unsubscribe: echo unsubscribe | mail abcde-request@whimsica.lly.org