HCoop
/
clinton
/
abcde.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
normalize changed with normalize-audio
[clinton/abcde.git]
/
abcde
diff --git
a/abcde
b/abcde
index
48490bc
..
5fedb1a
100755
(executable)
--- a/
abcde
+++ b/
abcde
@@
-11,7
+11,7
@@
# Copyright for this work is to expire January 1, 2010, after which it
# shall be public domain.
# Copyright for this work is to expire January 1, 2010, after which it
# shall be public domain.
-VERSION=
2.2pre2
+VERSION=
"2.1pre2.2.0"
usage ()
{
usage ()
{
@@
-20,6
+20,7
@@
echo "Usage: abcde [options] [tracks]"
echo "Options:"
echo "-1 Encode the whole CD in a single file"
echo "-a Actions to perform (cddb,read,normalize,encode,tag,move,playlist,clean)"
echo "Options:"
echo "-1 Encode the whole CD in a single file"
echo "-a Actions to perform (cddb,read,normalize,encode,tag,move,playlist,clean)"
+echo "-A Experimental actions (retag, transcode)"
echo "-b Batch mode: enable album normalization and nogap encoding"
echo "-c Specify a configuration file (overrides system and user config files)"
echo "-C Specify discid to resume from (only needed if you no longer have the cd)"
echo "-b Batch mode: enable album normalization and nogap encoding"
echo "-c Specify a configuration file (overrides system and user config files)"
echo "-C Specify discid to resume from (only needed if you no longer have the cd)"
@@
-38,8
+39,9
@@
echo "-m Modify playlist to include CRLF endings, to comply with some players
echo "-o Output file type(s) (ogg,mp3,flac,spx,mpc). Defaults to ogg"
echo "-p Pad track numbers with 0's (if less than 10 tracks)"
echo "-r [host1,host2...] Also encode on these remote hosts"
echo "-o Output file type(s) (ogg,mp3,flac,spx,mpc). Defaults to ogg"
echo "-p Pad track numbers with 0's (if less than 10 tracks)"
echo "-r [host1,host2...] Also encode on these remote hosts"
+echo "-R Add replaygain values to the tag info (ogg,flac)"
echo "-s Start the track numbering at a given number"
echo "-s Start the track numbering at a given number"
-echo "-S Set the CD speed
(if possible)
"
+echo "-S Set the CD speed"
#echo "-t File types to preprocess (wav)"
#echo "-T Set postprocessing options"
echo "-v Show version number and exit"
#echo "-t File types to preprocess (wav)"
#echo "-T Set postprocessing options"
echo "-v Show version number and exit"
@@
-301,6
+303,7
@@
do_tag ()
echo GENRE="$CDGENRE"
fi
echo TRACKNUMBER=$1
echo GENRE="$CDGENRE"
fi
echo TRACKNUMBER=$1
+ echo CDDB=$CDDBDISCID
if [ "$(eval echo ${COMMENT})" != "" ]; then
case "$COMMENTOUTPUT" in
*=*) echo "$COMMENTOUTPUT";;
if [ "$(eval echo ${COMMENT})" != "" ]; then
case "$COMMENTOUTPUT" in
*=*) echo "$COMMENTOUTPUT";;
@@
-329,13
+332,14
@@
do_tag ()
if [ -n "$CDGENRE" ]; then
echo GENRE="$CDGENRE"
fi
if [ -n "$CDGENRE" ]; then
echo GENRE="$CDGENRE"
fi
+ echo TRACKNUMBER=$1
+ echo CDDB=$CDDBDISCID
if [ "$(eval echo ${COMMENT})" != "" ]; then
case "$COMMENTOUTPUT" in
*=*) echo "$COMMENTOUTPUT";;
*) echo COMMENT="$COMMENTOUTPUT";;
esac
fi
if [ "$(eval echo ${COMMENT})" != "" ]; then
case "$COMMENTOUTPUT" in
*=*) echo "$COMMENTOUTPUT";;
*) echo COMMENT="$COMMENTOUTPUT";;
esac
fi
- echo TRACKNUMBER=$1
) | run_command tagtrack-$1 $METAFLAC --import-vc-from=- --no-utf8-convert "$ABCDETEMPDIR/track$1.$OUTPUT"
;;
spx)
) | run_command tagtrack-$1 $METAFLAC --import-vc-from=- --no-utf8-convert "$ABCDETEMPDIR/track$1.$OUTPUT"
;;
spx)
@@
-661,7
+665,7
@@
do_move ()
ALBUMFILE=$(mungefilename "$DALBUM")
ARTISTFILE=$(mungefilename "$TRACKARTIST")
TRACKFILE=$(mungefilename "$TRACKNAME")
ALBUMFILE=$(mungefilename "$DALBUM")
ARTISTFILE=$(mungefilename "$TRACKARTIST")
TRACKFILE=$(mungefilename "$TRACKNAME")
- GENRE=$(
echo $CDGENRE | tr "[:upper:]" "[:lower:]
")
+ GENRE=$(
mungegenre "$GENRE
")
YEAR=$(echo $CDYEAR)
# If we want to start the tracks with a given number, we need to modify the
# TRACKNUM value before evaluation
YEAR=$(echo $CDYEAR)
# If we want to start the tracks with a given number, we need to modify the
# TRACKNUM value before evaluation
@@
-701,7
+705,7
@@
do_playlist ()
for LASTTRACK in $TRACKQUEUE; do :; done
ALBUMFILE=$(mungefilename "$DALBUM")
ARTISTFILE=$(mungefilename "$DARTIST")
for LASTTRACK in $TRACKQUEUE; do :; done
ALBUMFILE=$(mungefilename "$DALBUM")
ARTISTFILE=$(mungefilename "$DARTIST")
- GENRE=$(
echo $CDGENRE | tr "[:upper:]" "[:lower:]
")
+ GENRE=$(
mungegenre "$GENRE
")
if [ "$VARIOUSARTISTS" = "y" ] ; then
PLAYLISTFILE=$(eval echo $VAPLAYLISTFORMAT)
else
if [ "$VARIOUSARTISTS" = "y" ] ; then
PLAYLISTFILE=$(eval echo $VAPLAYLISTFORMAT)
else
@@
-710,7
+714,6
@@
do_playlist ()
FINALPLAYLISTDIR=$(dirname "$OUTPUTDIR/$PLAYLISTFILE")
mkdir -p "$FINALPLAYLISTDIR"
if [ -s "$OUTPUTDIR/$PLAYLISTFILE" ]; then
FINALPLAYLISTDIR=$(dirname "$OUTPUTDIR/$PLAYLISTFILE")
mkdir -p "$FINALPLAYLISTDIR"
if [ -s "$OUTPUTDIR/$PLAYLISTFILE" ]; then
- ## FIXME ## Erase, Append or Keep the playlist?
#echo -n "Erase any existing playlist file? [y/n] (y): " >&2
echo -n "Erase, Append to, or Keep the existing playlist file? [e/a/k] (e): " >&2
if [ "$INTERACTIVE" = "y" ]; then
#echo -n "Erase any existing playlist file? [y/n] (y): " >&2
echo -n "Erase, Append to, or Keep the existing playlist file? [e/a/k] (e): " >&2
if [ "$INTERACTIVE" = "y" ]; then
@@
-725,7
+728,11
@@
do_playlist ()
echo e >&2
ERASEPLAYLIST=e
fi
echo e >&2
ERASEPLAYLIST=e
fi
- [ "$ERASEPLAYLIST" = "e" -o "$ERASEPLAYLIST" = "E" ] && rm -f "$OUTPUTDIR/$PLAYLISTFILE"
+ # Once we erase the playlist, we use append to create the new one.
+ [ "$ERASEPLAYLIST" = "e" -o "$ERASEPLAYLIST" = "E" ] && rm -f "$OUTPUTDIR/$PLAYLISTFILE" && ERASEPLAYLIST=a
+ else
+ # The playlist does not exist, so we can safelly use append to create the new list
+ ERASEPLAYLIST=a
fi
if [ "$ERASEPLAYLIST" = "a" -o "$ERASEPLAYLIST" = "A" ]; then
touch "$OUTPUTDIR/$PLAYLISTFILE"
fi
if [ "$ERASEPLAYLIST" = "a" -o "$ERASEPLAYLIST" = "A" ]; then
touch "$OUTPUTDIR/$PLAYLISTFILE"
@@
-782,6
+789,10
@@
do_playlist ()
do_discid ()
{
# Query the CD to get the track info, unless the user specified -C
do_discid ()
{
# Query the CD to get the track info, unless the user specified -C
+ # or we are using some actions which do not need the CDDB data at all
+ #if [ ! X"$EXPACTIONS" = "X" ]; then
+ # :
+ #elif [ -z "$DISCID" ]; then
if [ -z "$DISCID" ]; then
vecho -n "Getting CD track info... "
TRACKINFO=$($CDDISCID $CDROM)
if [ -z "$DISCID" ]; then
vecho -n "Getting CD track info... "
TRACKINFO=$($CDDISCID $CDROM)
@@
-800,6
+811,9
@@
do_discid ()
# it later.
# get the number of digits to pad TRACKNUM with - we'll use this later
# it later.
# get the number of digits to pad TRACKNUM with - we'll use this later
+ # a CD can only hold 99 tracks, but since we support a feature for starting
+ # numbering the tracks from a given number, we might need to set it as a
+ # variable for the user to define... or obtain it somehow.
if [ "$PADTRACKS" = "y" ] ; then
TRACKNUMPADDING=2
fi
if [ "$PADTRACKS" = "y" ] ; then
TRACKNUMPADDING=2
fi
@@
-864,7
+878,6
@@
do_discid ()
# We have the discid, create a temp directory after it to store all the temp
# info
# We have the discid, create a temp directory after it to store all the temp
# info
- ABCDETEMPDIR="$WAVOUTPUTDIR/abcde.$(echo $TRACKINFO | cut -f1 -d' ')"
if [ -e "$ABCDETEMPDIR" ]; then
echo -n "abcde: attempting to resume from $ABCDETEMPDIR"
# It already exists, see if it's a directory
if [ -e "$ABCDETEMPDIR" ]; then
echo -n "abcde: attempting to resume from $ABCDETEMPDIR"
# It already exists, see if it's a directory
@@
-1655,6
+1668,7
@@
OGGENCODERSYNTAX=default
FLACENCODERSYNTAX=default
SPEEXENCODERSYNTAX=default
MPPENCODERSYNTAX=default
FLACENCODERSYNTAX=default
SPEEXENCODERSYNTAX=default
MPPENCODERSYNTAX=default
+NORMALIZERSYNTAX=default
OUTPUTFORMAT='${ARTISTFILE}-${ALBUMFILE}/${TRACKNUM}.${TRACKFILE}'
# Use the following VAOUTPUTFORMAT to revert to 2.0.x VA format:
OUTPUTFORMAT='${ARTISTFILE}-${ALBUMFILE}/${TRACKNUM}.${TRACKFILE}'
# Use the following VAOUTPUTFORMAT to revert to 2.0.x VA format:
@@
-1674,7
+1688,6
@@
READNICE=10
DISTMP3NICE=10
VARIOUSARTISTS=n
VARIOUSARTISTSTYLE=forward
DISTMP3NICE=10
VARIOUSARTISTS=n
VARIOUSARTISTSTYLE=forward
-NORMALIZERSYNTAX=default
KEEPWAVS=n
PADTRACKS=n
CDDBCOPYLOCAL="n"
KEEPWAVS=n
PADTRACKS=n
CDDBCOPYLOCAL="n"
@@
-1716,8
+1729,9
@@
MD5SUM=md5sum
DISTMP3=distmp3
VORBISCOMMENT=vorbiscomment
METAFLAC=metaflac
DISTMP3=distmp3
VORBISCOMMENT=vorbiscomment
METAFLAC=metaflac
-NORMALIZE=normalize
+NORMALIZE=normalize
-audio
CDSPEED=eject
CDSPEED=eject
+VORBISGAIN=vorbisgain
# Options for programs called from abcde
# mp3
# Options for programs called from abcde
# mp3
@@
-1760,7
+1774,13
@@
ACTIONS=cddb,read,encode,tag,move,clean
# Custom filename munging:
mungefilename ()
{
# Custom filename munging:
mungefilename ()
{
- echo "$@" | sed s,:,\ -,g | sed 's,*,-,g' | tr \ / __ | tr -d \'\"\?\[:cntrl:\]
+ echo "$@" | sed s,:,\ -,g | tr \ /\* __+ | tr -d \'\"\?\[:cntrl:\]
+}
+
+# Custom genre munging:
+mungegenre ()
+{
+ echo $CDGENRE | tr "[:upper:]" "[:lower:]"
}
# pre_read
}
# pre_read
@@
-1841,10
+1861,11
@@
fi
# Parse command line options
#while getopts 1a:bc:C:d:Dhj:klLnNo:pr:S:t:T:vVx opt ; do
# Parse command line options
#while getopts 1a:bc:C:d:Dhj:klLnNo:pr:S:t:T:vVx opt ; do
-while getopts 1a:
bc:C:d:Dhj:klLnNo:pr:
s:S:vVx opt ; do
+while getopts 1a:
A:bc:C:d:Dhj:klLnNo:pr:R
s:S:vVx opt ; do
case "$opt" in
1) ONETRACK=y ;;
a) ACTIONS="$OPTARG" ;;
case "$opt" in
1) ONETRACK=y ;;
a) ACTIONS="$OPTARG" ;;
+ A) EXPACTIONS="$OPTARG";;
b) BATCH=y ;;
c) if [ -e "$OPTARG" ] ; then . "$OPTARG" ; else echo "abcde error: config file \"$OPTARG\" cannot be found." >&2 ; exit 1 ; fi ;;
C) DISCID="${OPTARG#abcde.}" ;;
b) BATCH=y ;;
c) if [ -e "$OPTARG" ] ; then . "$OPTARG" ; else echo "abcde error: config file \"$OPTARG\" cannot be found." >&2 ; exit 1 ; fi ;;
C) DISCID="${OPTARG#abcde.}" ;;
@@
-1863,6
+1884,7
@@
while getopts 1a:bc:C:d:Dhj:klLnNo:pr:s:S:vVx opt ; do
o) OUTPUTTYPE="$OPTARG" ;;
p) PADTRACKS="y" ;;
r) REMOTEHOSTS="$OPTARG" ;;
o) OUTPUTTYPE="$OPTARG" ;;
p) PADTRACKS="y" ;;
r) REMOTEHOSTS="$OPTARG" ;;
+ R) REPLAYGAIN=y ;;
s) STARTTRACKNUMBER="$OPTARG" ;;
S) CDSPEEDVALUE="$OPTARG" ;;
t) PREPROCESSFORMATS="$OPTARG"
s) STARTTRACKNUMBER="$OPTARG" ;;
S) CDSPEEDVALUE="$OPTARG" ;;
t) PREPROCESSFORMATS="$OPTARG"
@@
-1965,6
+1987,7
@@
do
case $OUTPUT in
ogg) [ "$OGGENCODERSYNTAX" = "default" ] && OGGENCODERSYNTAX=oggenc
echo $ACTIONS | grep tag > /dev/null 2>&1 && NEEDCOMMENTER=y
case $OUTPUT in
ogg) [ "$OGGENCODERSYNTAX" = "default" ] && OGGENCODERSYNTAX=oggenc
echo $ACTIONS | grep tag > /dev/null 2>&1 && NEEDCOMMENTER=y
+ if [ "$REPLAYGAIN" = "y" ]; then NEEDVORBISGAIN=y; fi
;;
mp3) [ "$MP3ENCODERSYNTAX" = "default" ] && MP3ENCODERSYNTAX=lame
echo $ACTIONS | grep tag > /dev/null 2>&1 && NEEDTAGGER=y
;;
mp3) [ "$MP3ENCODERSYNTAX" = "default" ] && MP3ENCODERSYNTAX=lame
echo $ACTIONS | grep tag > /dev/null 2>&1 && NEEDTAGGER=y
@@
-2078,7
+2101,8
@@
for X in $CDROMREADER $CDDISCID ${NEEDTAGGER+$TAGGER} $MP3ENCODER \
${NEEDHTTPGET+$HTTPGET} ${NEEDDISTMP3+$DISTMP3} \
${NEEDCOMMENTER+$VORBISCOMMENT} ${NEEDMETAFLAC+$METAFLAC} \
${NEEDNORMALIZER+$NORMALIZER} ${NEEDEJECT+$EJECT} \
${NEEDHTTPGET+$HTTPGET} ${NEEDDISTMP3+$DISTMP3} \
${NEEDCOMMENTER+$VORBISCOMMENT} ${NEEDMETAFLAC+$METAFLAC} \
${NEEDNORMALIZER+$NORMALIZER} ${NEEDEJECT+$EJECT} \
- ${NEEDDISKTOOL+disktool} ${NEEDCDSPEED+$CDSPEED}
+ ${NEEDDISKTOOL+disktool} ${NEEDCDSPEED+$CDSPEED} \
+ ${NEEDVORBISGAIN+$VORBISGAIN}
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)
@@
-2095,9
+2119,12
@@
CDROMREADER="$CDROMREADER $CDROMREADEROPTS"
CDDBTOOL="$CDDBTOOL $CDDBTOOLOPTS"
HTTPGET="$HTTPGET $HTTPGETOPTS"
CDDBTOOL="$CDDBTOOL $CDDBTOOLOPTS"
HTTPGET="$HTTPGET $HTTPGETOPTS"
-# One thousand seven hundred lines in, we can start doing stuff with things
+# Here it used to say:
+# One thousand lines in, we can start doing stuff with things
+# Well, right now we are at line 2116 ;)
-# List of valid actions: cddb,playlist,read,normalize,encode,tag,move
+# List of valid actions: cddb,read,normalize,encode,tag,playlist,move,clean
+# List of experimental actions: retag,transcode
# Export needed things so they can be read in this subshell
export CDDBTOOL ABCDETEMPDIR TRACKQUEUE LOWDISK EJECTCD EJECT EJECTOPTS
# Export needed things so they can be read in this subshell
export CDDBTOOL ABCDETEMPDIR TRACKQUEUE LOWDISK EJECTCD EJECT EJECTOPTS