HCoop
/
clinton
/
abcde.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added replaygain to mpp
[clinton/abcde.git]
/
abcde
diff --git
a/abcde
b/abcde
index
def090c
..
d4bd83d
100755
(executable)
--- a/
abcde
+++ b/
abcde
@@
-20,9
+20,10
@@
echo "Usage: abcde [options] [tracks]"
echo "Options:"
echo "-1 Encode the whole CD in a single file"
echo "-a <action1[,action2]...>"
echo "Options:"
echo "-1 Encode the whole CD in a single file"
echo "-a <action1[,action2]...>"
-echo " Actions to perform (cddb,read,normalize,encode,tag,move,playlist,clean)"
+echo " Actions to perform (cddb,read,normalize,encode,tag,move,
replaygain,
playlist,clean)"
#echo "-A Experimental actions (retag, transcode)"
echo "-b Enable batch normalization"
#echo "-A Experimental actions (retag, transcode)"
echo "-b Enable batch normalization"
+#echo "-B Disable batch replaygain (do file by file)"
echo "-c <file>"
echo " Specify a configuration file (overrides system and user config files)"
echo "-C <discid#>"
echo "-c <file>"
echo " Specify a configuration file (overrides system and user config files)"
echo "-C <discid#>"
@@
-50,12
+51,13
@@
echo "-p Pad track numbers with 0's (if less than 10 tracks)"
echo "-P Use UNIX pipes to read+encode without wav files"
echo "-r <host1[,host2]...>"
echo " Also encode on these remote hosts"
echo "-P Use UNIX pipes to read+encode without wav files"
echo "-r <host1[,host2]...>"
echo " Also encode on these remote hosts"
-
echo "-R Add replaygain values to the tag info (only for vorbis,flac
)"
+
#echo "-R Add replaygain values to the tag info (only for vorbis,flac,mp3
)"
echo "-s <field>"
echo " Show dielfs from the CDDB info (year,genre)"
echo "-S <#> Set the CD speed"
echo "-t <#> Start the track numbering at a given number"
echo "-T <#> Same as -t but modifies tag numbering"
echo "-s <field>"
echo " Show dielfs from the CDDB info (year,genre)"
echo "-S <#> Set the CD speed"
echo "-t <#> Start the track numbering at a given number"
echo "-T <#> Same as -t but modifies tag numbering"
+echo "-u Use UNICODE tags and comments"
echo "-v Show version number and exit"
echo "-V Be a bit more verbose about what is happening behind the scenes"
echo "-x Eject CD after all tracks are read"
echo "-v Show version number and exit"
echo "-V Be a bit more verbose about what is happening behind the scenes"
echo "-x Eject CD after all tracks are read"
@@
-366,7
+368,6
@@
do_replaygain()
if checkstatus replaygain; then :; else
run_command "" echo "Adding replygain information..."
for OUTPUT in $( echo $OUTPUTTYPE | tr , \ )
if checkstatus replaygain; then :; else
run_command "" echo "Adding replygain information..."
for OUTPUT in $( echo $OUTPUTTYPE | tr , \ )
- # THE OUTPUT NEEDS TO BE CORRECTED WITH THE CONTAINER?
do
case $OUTPUT in
vorbis|ogg)
do
case $OUTPUT in
vorbis|ogg)
@@
-377,6
+378,7
@@
do_replaygain()
;;
esac
OUTPUTFILES=""
;;
esac
OUTPUTFILES=""
+ REPLAYINDEX=0
for UTRACKNUM in $TRACKQUEUE
do
CDDBTRACKNUM=$(expr $UTRACKNUM - 1)
for UTRACKNUM in $TRACKQUEUE
do
CDDBTRACKNUM=$(expr $UTRACKNUM - 1)
@@
-387,23
+389,30
@@
do_replaygain()
ALBUMFILE="$(mungefilename "$DALBUM")"
do_gettracknum
if [ "$VARIOUSARTISTS" = "y" ]; then
ALBUMFILE="$(mungefilename "$DALBUM")"
do_gettracknum
if [ "$VARIOUSARTISTS" = "y" ]; then
- OUTPUTFILE=
$(eval echo $VAOUTPUTFORMAT)
+ OUTPUTFILE=
"$(eval echo $VAOUTPUTFORMAT)"
else
else
- OUTPUTFILE=
$(eval echo $OUTPUTFORMAT)
+ OUTPUTFILE=
"$(eval echo $OUTPUTFORMAT)"
fi
fi
- OUTPUTFILES="$OUTPUTDIR/$OUTPUTFILE.$OUTPUT $OUTPUTFILES"
+ OUTPUTFILES[$REPLAYINDEX]="$OUTPUTDIR/$OUTPUTFILE.$OUTPUT"
+ (( REPLAYINDEX = $REPLAYINDEX + 1 ))
done
case "$OUTPUT" in
flac)
done
case "$OUTPUT" in
flac)
- run_command replaygain-flac $METAFLAC --add-replay-gain
$OUTPUTFILES
+ run_command replaygain-flac $METAFLAC --add-replay-gain
"${OUTPUTFILES[@]}"
;;
vorbis|ogg)
;;
vorbis|ogg)
- run_command replaygain-vorbis $VORBISGAIN --album $OUTPUTFILES
+ run_command replaygain-vorbis $VORBISGAIN --album "${OUTPUTFILES[@]}"
+ ;;
+ mp3)
+ run_command replaygain-mp3 $MP3GAIN -a "${OUTPUTFILES[@]}"
+ ;;
+ mpc)
+ run_command replaygain-mpc $MPPGAIN --auto "${OUTPUTFILES[@]}"
;;
*);;
esac
done
;;
*);;
esac
done
- if checkerrors
replaygain-.{3,6}
; then :; else
+ if checkerrors
"replaygain-.{3,6}"
; then :; else
run_command replaygain true
fi
fi
run_command replaygain true
fi
fi
@@
-851,6
+860,8
@@
do_encode ()
esac
if [ X"$USEPIPES" = "Xy" ]; then
RUN_COMMAND=""
esac
if [ X"$USEPIPES" = "Xy" ]; then
RUN_COMMAND=""
+ # We need a way to store the creation of the files when using PIPES
+ RUN_COMMAND_PIPES="run_command encodetrack-$OUTPUT-$1 true"
else
run_command '' echo "Encoding track $1 of $TRACKS: $TRACKNAME..."
RUN_COMMAND="run_command encodetrack-$OUTPUT-$1"
else
run_command '' echo "Encoding track $1 of $TRACKS: $TRACKNAME..."
RUN_COMMAND="run_command encodetrack-$OUTPUT-$1"
@@
-889,7
+900,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
-f
$FLACENCODEROPTS -o "$OUT" "$IN" ;;
esac
;;
*)
esac
;;
*)
@@
-925,9
+936,9
@@
do_encode ()
;;
wav)
# In case of wav output we need nothing. Just keep the wavs.
;;
wav)
# In case of wav output we need nothing. Just keep the wavs.
- run_command encodetrack-$OUTPUT-$1 true
;;
esac
;;
esac
+ $RUN_COMMAND_PIPES
done
# Only remove .wav if the encoding succeeded
if checkerrors "encodetrack-(.{3,6})-$1"; then :; else
done
# Only remove .wav if the encoding succeeded
if checkerrors "encodetrack-(.{3,6})-$1"; then :; else
@@
-1034,7
+1045,7
@@
do_single_gain ()
# do_batch_gain
# variables used:
# do_batch_gain
# variables used:
-# MP3GAIN, MP3GAINOPTS, VORBISGAIN, VORBISGAINOPTS
+# MP3GAIN, MP3GAINOPTS, VORBISGAIN, VORBISGAINOPTS
, MPPGAIN, MPPGAINOPTS
# FIXME #
do_batch_gain ()
{
# FIXME #
do_batch_gain ()
{
@@
-2270,8
+2281,12
@@
fi
decho ()
{
if [ x"$DEBUG" != "x" ]; then
decho ()
{
if [ x"$DEBUG" != "x" ]; then
- DEBUGECHO=$(echo "$@" | tr -d '[]')
- echo "[DEBUG] $DEBUGECHO: `eval echo \\$${DEBUGECHO}`"
+ if echo $1 | grep -q "^\[" ; then
+ DEBUGECHO=$(echo "$@" | tr -d '[]')
+ echo "[DEBUG] $DEBUGECHO: `eval echo \\$${DEBUGECHO}`"
+ else
+ echo "[DEBUG] $1"
+ fi
fi
}
fi
}
@@
-2399,6
+2414,8
@@
METAFLAC=metaflac
NORMALIZE=normalize-audio
CDSPEED=eject
VORBISGAIN=vorbisgain
NORMALIZE=normalize-audio
CDSPEED=eject
VORBISGAIN=vorbisgain
+MP3GAIN=mp3gain
+MPPGAIN=replaygain
MKCUE=mkcue
MKTOC=cdrdao
DIFF=diff
MKCUE=mkcue
MKTOC=cdrdao
DIFF=diff
@@
-2417,7
+2434,7
@@
MP3ENCOPTS=
VORBIZEOPTS=
OGGENCOPTS=
# flac
VORBIZEOPTS=
OGGENCOPTS=
# flac
-FLACOPTS=
"-f"
+FLACOPTS=
# speex
SPEEXENCOPTS=
# mpc
# speex
SPEEXENCOPTS=
# mpc
@@
-2439,6
+2456,7
@@
MKCUEOPTS=
MKTOCOPTS=""
VORBISCOMMENTOPTS="-R"
METAFLACOPTS="--no-utf8-convert"
MKTOCOPTS=""
VORBISCOMMENTOPTS="-R"
METAFLACOPTS="--no-utf8-convert"
+DIFFOPTS=
# Default to one process if -j isn't specified
MAXPROCS=1
# Default to one process if -j isn't specified
MAXPROCS=1
@@
-2528,12
+2546,13
@@
fi
# Parse command line options
#while getopts 1a:A:bc:C:d:Dehj:klLmMnNo:pPr:Rs:S:t:T:vVxw:W: opt ; do
# 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:b
c:C:d:Defghj:klLmMnNo:pPr:Rs:S:t:T:
vVxw:W:z opt ; do
+while getopts 1a:b
Bc:C:d:Defghj:klLmMnNo:pPr:s:S:t:T:u
vVxw:W:z opt ; do
case "$opt" in
1) ONETRACK=y ;;
a) ACTIONS="$OPTARG" ;;
A) EXPACTIONS="$OPTARG" ;;
b) BATCHNORM=y ;;
case "$opt" in
1) ONETRACK=y ;;
a) ACTIONS="$OPTARG" ;;
A) EXPACTIONS="$OPTARG" ;;
b) BATCHNORM=y ;;
+ B) NOBATCHREPLAYGAIN=y ;;
c) if [ -e "$OPTARG" ] ; then . "$OPTARG" ; else log error "config file \"$OPTARG\" cannot be found." ; exit 1 ; fi ;;
C) DISCID="${OPTARG#abcde.}" ;;
d) CDROM="$OPTARG" ;;
c) if [ -e "$OPTARG" ] ; then . "$OPTARG" ; else log error "config file \"$OPTARG\" cannot be found." ; exit 1 ; fi ;;
C) DISCID="${OPTARG#abcde.}" ;;
d) CDROM="$OPTARG" ;;
@@
-2557,14
+2576,12
@@
while getopts 1a:bc:C:d:Defghj:klLmMnNo:pPr:Rs:S:t:T:vVxw:W:z opt ; do
p) PADTRACKS=y ;;
P) USEPIPES=y ;;
r) REMOTEHOSTS="$OPTARG" ;;
p) PADTRACKS=y ;;
P) USEPIPES=y ;;
r) REMOTEHOSTS="$OPTARG" ;;
- R) REPLAYGAIN=y ;;
+ R)
DO
REPLAYGAIN=y ;;
s) SHOWCDDBFIELDS="$OPTARG" ;;
S) CDSPEEDVALUE="$OPTARG" ;;
s) SHOWCDDBFIELDS="$OPTARG" ;;
S) CDSPEEDVALUE="$OPTARG" ;;
-# t) PREPROCESSFORMATS="$OPTARG"
-# PREPROCESS=y ;;
-# T) POSTPROCESSFORMATS="$OPTARG" ;;
t) STARTTRACKNUMBER="$OPTARG" ;;
T) STARTTRACKNUMBER="$OPTARG" ; STARTTRACKNUMBERTAG="y" ;;
t) STARTTRACKNUMBER="$OPTARG" ;;
T) STARTTRACKNUMBER="$OPTARG" ; STARTTRACKNUMBERTAG="y" ;;
+ u) CDDBPROTO=6 ;;
v)
echo "This is abcde v$VERSION."
echo "Usage: abcde [options] [tracks]"
v)
echo "This is abcde v$VERSION."
echo "Usage: abcde [options] [tracks]"
@@
-2598,6
+2615,9
@@
if echo $CDROM | grep -i -q '.flac$'; then
fi
fi
fi
fi
+# If the user provided a DISCID, disable eject
+if [ -n "$DISCID" ]; then EJECTCD=n ; fi
+
# Decide if we can continue.
if [ "$ONETRACK" = "y" ]; then
# FIXME # remove check as soon as we find out about the other readers
# Decide if we can continue.
if [ "$ONETRACK" = "y" ]; then
# FIXME # remove check as soon as we find out about the other readers
@@
-2672,7
+2692,7
@@
done
if [ "$DONORMALIZE" = "y" ] && [ "$DOREPLAYGAIN" = "y" ]; then
# FIXME # should we abort on error or just inform the user?
if [ "$DONORMALIZE" = "y" ] && [ "$DOREPLAYGAIN" = "y" ]; then
# FIXME # should we abort on error or just inform the user?
- :
+ log warning "selected both normalize and replaygain actions"
fi
for SHOWCDDBFIELD in $(echo $SHOWCDDBFIELDS | tr , \ ); do
fi
for SHOWCDDBFIELD in $(echo $SHOWCDDBFIELDS | tr , \ ); do
@@
-2838,23
+2858,26
@@
do
vorbis|ogg)
[ "$OGGENCODERSYNTAX" = "default" ] && OGGENCODERSYNTAX=oggenc
[ "$DOTAG" = "y" ] && NEEDCOMMENTER=y
vorbis|ogg)
[ "$OGGENCODERSYNTAX" = "default" ] && OGGENCODERSYNTAX=oggenc
[ "$DOTAG" = "y" ] && NEEDCOMMENTER=y
- [ "$REPLAYGAIN" = "y" ] && NEEDVORBISGAIN=y
+ [ "$
DO
REPLAYGAIN" = "y" ] && NEEDVORBISGAIN=y
OGGOUTPUTCONTAINER=ogg
;;
mp3)
[ "$MP3ENCODERSYNTAX" = "default" ] && MP3ENCODERSYNTAX=lame
[ "$DOTAG" = "y" ] && NEEDTAGGER=y
OGGOUTPUTCONTAINER=ogg
;;
mp3)
[ "$MP3ENCODERSYNTAX" = "default" ] && MP3ENCODERSYNTAX=lame
[ "$DOTAG" = "y" ] && NEEDTAGGER=y
+ [ "$DOREPLAYGAIN" = "y" ] && NEEDMP3GAIN=y
;;
flac)
[ "$FLACENCODERSYNTAX" = "default" ] && FLACENCODERSYNTAX=flac
;;
flac)
[ "$FLACENCODERSYNTAX" = "default" ] && FLACENCODERSYNTAX=flac
- [ "$REPLAYGAIN" = "y" ] && NEEDMETAFLAC=y
[ "$DOTAG" = "y" ] && NEEDMETAFLAC=y
[ "$DOTAG" = "y" ] && NEEDMETAFLAC=y
+ [ "$DOREPLAYGAIN" = "y" ] && NEEDMETAFLAC=y
;;
spx)
[ "$SPEEXENCODERSYNTAX" = "default" ] && SPEEXENCODERSYNTAX=speexenc
;;
spx)
[ "$SPEEXENCODERSYNTAX" = "default" ] && SPEEXENCODERSYNTAX=speexenc
+# [ "$DOREPLAYGAIN" = "y" ] &&
;;
mpc)
[ "$MPPENCODERSYNTAX" = "default" ] && MPPENCODERSYNTAX=mppenc
;;
mpc)
[ "$MPPENCODERSYNTAX" = "default" ] && MPPENCODERSYNTAX=mppenc
+ [ "$DOREPLAYGAIN" = "y" ] && NEEDMPPGAIN=y
;;
wav)
if [ "$KEEPWAVS" = "y" ]; then
;;
wav)
if [ "$KEEPWAVS" = "y" ]; then
@@
-3009,9
+3032,12
@@
if [ X"$CDSPEEDVALUE" != "X" ]; then
esac
fi
esac
fi
+###USEPIPESSUPPORT###
+
# Rippers with USEPIPE support
# FIXME # Include here all the rippers we can figure out support pipes
PIPERIPPER_cdparanoia="-"
# Rippers with USEPIPE support
# FIXME # Include here all the rippers we can figure out support pipes
PIPERIPPER_cdparanoia="-"
+PIPERIPPER_debug="-"
PIPERIPPER_flac="-c "
# Encoders with USEPIPE support
PIPERIPPER_flac="-c "
# Encoders with USEPIPE support
@@
-3037,14
+3063,17
@@
if [ "$USEPIPES" = "y" ]; then
mpc)
PIPEENCODERSVARCHECK="PIPE_$MPPENCODER" ;;
esac
mpc)
PIPEENCODERSVARCHECK="PIPE_$MPPENCODER" ;;
esac
- if [ "$( eval echo "\$$PIPERIPPERSVARCHECK" )" = "$" ] ; then
+ decho "PIPERIPPERSVARCHECK: $( eval echo "\$$PIPERIPPERSVARCHECK" )"
+ if [ "$( eval echo "\$$PIPERIPPERSVARCHECK" )" = "$" ] || \
+ [ "$( eval echo "\$$PIPERIPPERSVARCHECK" )" = "" ] ; then
log error "no support for pipes with given ripper"
log error "read the USEPIPES file from the source tarball to get help."
log error "On a Debian system, it is under /usr/share/doc/abcde/USEPIPES.gz"
exit 1;
fi
log error "no support for pipes with given ripper"
log error "read the USEPIPES file from the source tarball to get help."
log error "On a Debian system, it is under /usr/share/doc/abcde/USEPIPES.gz"
exit 1;
fi
- vecho PIPES: "$( eval echo "\$$PIPEENCODERSVARCHECK" )"
- if [ "$( eval echo "\$$PIPEENCODERSVARCHECK" )" = "$" ] ; then
+ decho "PIPEENCODERSVARCHECK: $( eval echo "\$$PIPEENCODERSVARCHECK" )"
+ if [ "$( eval echo "\$$PIPEENCODERSVARCHECK" )" = "$" ] || \
+ [ "$( eval echo "\$$PIPEENCODERSVARCHECK" )" = "" ] ; then
log error "no support for pipes with given encoder"
log error "read the USEPIPES file from the source tarball to help"
log error "on a Debian system, read /usr/share/doc/abcde/USEPIPES.gz"
log error "no support for pipes with given encoder"
log error "read the USEPIPES file from the source tarball to help"
log error "on a Debian system, read /usr/share/doc/abcde/USEPIPES.gz"
@@
-3059,8
+3088,9
@@
for X in $CDROMREADER $CDDISCID ${NEEDTAGGER+$TAGGER} $MP3ENCODER \
${NEEDCOMMENTER+$VORBISCOMMENT} ${NEEDMETAFLAC+$METAFLAC} \
${NEEDNORMALIZER+$NORMALIZER} ${NEEDEJECT+$EJECT} \
${NEEDDISKTOOL+disktool} ${NEEDCDSPEED+$CDSPEED} \
${NEEDCOMMENTER+$VORBISCOMMENT} ${NEEDMETAFLAC+$METAFLAC} \
${NEEDNORMALIZER+$NORMALIZER} ${NEEDEJECT+$EJECT} \
${NEEDDISKTOOL+disktool} ${NEEDCDSPEED+$CDSPEED} \
- ${NEEDVORBISGAIN+$VORBISGAIN} ${NEEDCUEREADER+$CUEREADER} \
- ${NEEDCUE2DISCID+$CUE2DISCID}
+ ${NEEDVORBISGAIN+$VORBISGAIN} ${NEEDMP3GAIN+$MP3GAIN} \
+ ${NEEDMPPGAIN+$MPPGAIN} \
+ ${NEEDCUEREADER+$CUEREADER} ${NEEDCUE2DISCID+$CUE2DISCID}
do
# Cut off the command-line options we just added in
X=$(echo $X | cut -d' ' -f2)
do
# Cut off the command-line options we just added in
X=$(echo $X | cut -d' ' -f2)
@@
-3190,6
+3220,11
@@
else
if [ "$NOGAP" = "y" ] || [ "$BATCHNORM" = "y" ]; then
:
else
if [ "$NOGAP" = "y" ] || [ "$BATCHNORM" = "y" ]; then
:
else
+ # If we are not reading, set the encode output to loud already, so
+ # that we can see the output of the first track.
+ if [ "$MAXPROCS" = "1" ] && [ ! "$DOREAD" = "y" ]; then
+ echo "encode-output=loud" >> "$ABCDETEMPDIR/status"
+ fi
echo NEXTTRACK # Get the encoder machine churning again
if [ "$DOREAD" = "y" ]; then
if [ "$LOWDISK" = "y" ] && [ "$DOENCODE" = "y" ]; then
echo NEXTTRACK # Get the encoder machine churning again
if [ "$DOREAD" = "y" ]; then
if [ "$LOWDISK" = "y" ] && [ "$DOENCODE" = "y" ]; then
@@
-3440,9
+3475,14
@@
if [ "$DOENCODE" = "y" -a "$USEPIPES" != "y" ]; then
fi
# If the above didn't catch the stragglers, this will
wait
fi
# If the above didn't catch the stragglers, this will
wait
-if [ "$REPLAYGAIN" = "y" ]; then
+if [ "$
DO
REPLAYGAIN" = "y" ]; then
do_replaygain
fi
do_replaygain
fi
+
+# FIXME #
+# Check if all the encoded formats have been actually moved to the final destination
+# ...
+
# Check to see if run_command logged any errors
if [ -f "$ABCDETEMPDIR/errors" ]; then
log error "The following commands failed to run:"
# Check to see if run_command logged any errors
if [ -f "$ABCDETEMPDIR/errors" ]; then
log error "The following commands failed to run:"