[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[abcde] Multi-Artist
On Mon, Sep 25, 2000 at 10:04:08PM -0700, Robert Woodcock wrote:
> I took that feature out when I was rewriting things - I haven't put it back
> in yet.
I couldn't wait... so here's my stab at it. No heuristics yet: it just
right out asks if the CD is multi-artist (in non-interactive mode, it
assumes the CD isn't). Also, I did this before the 1.9.3 release and
so it's a patch against 1.9.2, however I only see one direct clash: in
the fix for mp3enc. But I'm too lazy to fix it just now... a good job
for tkdiff.
Kevin.
-- Attached file included as plaintext by Listar --
diff -urN orig/abcde-1.9.2/abcde abcde-1.9.2/abcde
--- orig/abcde-1.9.2/abcde Mon Sep 25 22:27:22 2000
+++ abcde-1.9.2/abcde Wed Sep 27 11:12:36 2000
@@ -131,10 +131,51 @@
echo $TO
}
+# This code splits the a Various Artist track name from one of the following
+# forms:
+#
+# forward: Artist / Track
+# forward-dash: Artist - Track
+# reverse: Track / Artist
+# reverse-dash: Track - Artist
+#
+# variables used:
+# VARIOUSARTISTS, VARIOUSARTISTSTYLE, TRACKNAME, TRACKARTIST
+splitvarious ()
+{
+# set +e
+ if [ "$VARIOUSARTISTS" = "y" ]; then
+ case "$VARIOUSARTISTSTYLE" in
+ forward)
+ DTITLEARTIST="$(echo $TRACKNAME | sed 's- / -~-g')"
+ TRACKARTIST="$(echo $DTITLEARTIST | cut -f1 -d~)"
+ TRACKNAME="$(echo $DTITLEARTIST | cut -f2 -d~)"
+ ;;
+ forward-dash)
+ DTITLEARTIST="$(echo $TRACKNAME | sed 's, - ,~,g')"
+ TRACKARTIST="$(echo $DTITLEARTIST | cut -f1 -d~)"
+ TRACKNAME="$(echo $DTITLEARTIST | cut -f2 -d~)"
+ ;;
+ reverse)
+ DTITLEARTIST="$(echo $TRACKNAME | sed 's- / -~-g')"
+ TRACKARTIST="$(echo $DTITLEARTIST | cut -f2 -d~)"
+ TRACKNAME="$(echo $DTITLEARTIST | cut -f1 -d~)"
+ ;;
+ reverse-dash)
+ DTITLEARTIST="$(echo $TRACKNAME | sed 's, - ,~,g')"
+ TRACKARTIST="$(echo $DTITLEARTIST | cut -f2 -d~)"
+ TRACKNAME="$(echo $DTITLEARTIST | cut -f1 -d~)"
+ ;;
+ esac
+ else
+ TRACKARTIST=$DARTIST
+ fi
+}
+
# do_tag [tracknumber]
# id3 tags a filename
# variables used:
-# TRACKS, TRACKNAME, ID3, ID3OPTS, ID3COMMENT, DALBUM, DARTIST
+# TRACKS, TRACKNAME, TRACKARTIST, ID3, ID3OPTS, ID3COMMENT, DALBUM, DARTIST
do_tag ()
{
# Ogg commenting is typically done by the encoder since it's at the
@@ -142,14 +183,14 @@
if [ "$OUTPUTTYPE" = "mp3" ]; then
run_command '' echo "Tagging track $1 of $TRACKS: $TRACKNAME..."
run_command tagtrack-$1 $ID3 $ID3OPTS -c "$(eval echo ${ID3COMMENT})" \
- -A "$DALBUM" -a "$DARTIST" -t "$TRACKNAME" -T "$1" "$ABCDETEMPDIR/track$1.$OUTPUTTYPE"
+ -A "$DALBUM" -a "$TRACKARTIST" -t "$TRACKNAME" -T "$1" "$ABCDETEMPDIR/track$1.$OUTPUTTYPE"
fi
}
# do_encode [tracknumber] [hostname]
# If no hostname is specified, encode locally
# variables used:
-# TRACKS, TRACKNAME, DISTMP3, DISTMP3OPTS, ENCODERSYNTAX, OUTPUTTYPE, ENCODEROPTS, DALBUM, DARTIST, ENCNICE
+# TRACKS, TRACKNAME, TRACKARTIST, DISTMP3, DISTMP3OPTS, ENCODERSYNTAX, OUTPUTTYPE, ENCODEROPTS, DALBUM, DARTIST, ENCNICE
do_encode ()
{
IN="$ABCDETEMPDIR/track$1.wav"
@@ -169,8 +210,8 @@
;;
ogg)
case "$ENCODERSYNTAX" in
- vorbize) run_command encodetrack-$1 nice $ENCNICE $ENCODER $ENCODEROPTS -w "$OUT" -a "$DARTIST" -t "$TRACKNAME" -l "$DALBUM" "$IN" ;;
- oggenc) run_command encodetrack-$1 nice $ENCNICE $ENCODER $ENCODEROPTS "$IN" -o "$OUT" -a "$DARTIST" -t "$TRACKNAME" -l "$DALBUM" ;;
+ vorbize) run_command encodetrack-$1 nice $ENCNICE $ENCODER $ENCODEROPTS -w "$OUT" -a "$TRACKARTIST" -t "$TRACKNAME" -l "$DALBUM" "$IN" ;;
+ oggenc) run_command encodetrack-$1 nice $ENCNICE $ENCODER $ENCODEROPTS "$IN" -o "$OUT" -a "$TRACKARTIST" -t "$TRACKNAME" -l "$DALBUM" ;;
esac
;;
esac
@@ -181,7 +222,7 @@
# Deduces the outfile from environment variables
# Creates directory if necessary
# variables used:
-# TRACKNUM, TRACKNAME, DALBUM, DARTIST, OUTPUTFORMAT
+# TRACKNUM, TRACKNAME, TRACKARTIST, DALBUM, OUTPUTFORMAT
do_move ()
{
# Create ALBUMFILE, ARTISTFILE, TRACKFILE
@@ -192,7 +233,7 @@
# '?' -> ''
# Eat control characters
ALBUMFILE=$(mungefilename $DALBUM)
- ARTISTFILE=$(mungefilename $DARTIST)
+ ARTISTFILE=$(mungefilename $TRACKARTIST)
TRACKFILE=$(mungefilename $TRACKNAME)
# Supported variables for OUTPUTFORMAT are ALBUMFILE, ARTISTFILE, TRACKFILE, and TRACKNUM.
OUTPUTFILE=$(eval echo $OUTPUTFORMAT)
@@ -227,7 +268,9 @@
# Shares some code with do_move since the filenames have to match
CDDBTRACKNUM=$(expr $UTRACKNUM - 1)
TRACKNAME=$(grep ^TTITLE$CDDBTRACKNUM= "$CDDBDATA" | head -1 | cut -f2 -d= | tr -d \[:cntrl:\])
+ splitvarious
TRACKFILE=$(mungefilename $TRACKNAME)
+ ARTISTFILE=$(mungefilename $TRACKARTIST)
OUTPUTFILE=$(eval echo $OUTPUTFORMAT)
if [ "$PLAYLISTDATAPREFIX" != "" ]; then
echo -n $PLAYLISTDATAPREFIX >> "$OUTPUTDIR/$PLAYLISTFILE"
@@ -555,6 +598,44 @@
fi
fi
+ echo -n "Is the CD multi-artist? [y/n] (n): "
+ if [ "$INTERACTIVE" = "y" ]; then
+ read VARIOUSARTISTS
+ else
+ echo n
+ VARIOUSARTISTS=n
+ fi
+ if [ "$VARIOUSARTISTS" = "y" ]; then
+ echo "1) Artist / Title"
+ echo "2) Artist - Title"
+ echo "3) Title / Artist"
+ echo "4) Title - Artist"
+ echo -n "Which style of multiple artist entries is it? [1-4]: "
+ read VARIOUSARTISTSTYLE
+ VARIOUSARTISTSTYLE=$(echo $VARIOUSARTISTSTYLE | xargs printf %d)
+ while [ $VARIOUSARTISTSTYLE -lt 1 ] || [ $VARIOUSARTISTSTYLE -gt 4 ]; do
+ echo "Invalid selection. Please choose a number between 1 and 4."
+ echo -n "Selection [1-4]: "
+ read VARIOUSARTISTSTYLE
+ VARIOUSARTISTSTYLE=$(echo $VARIOUSARTISTSTYLE | xargs printf %d)
+ done
+ echo "Selected: $VARIOUSARTISTSTYLE"
+ case "$VARIOUSARTISTSTYLE" in
+ 1) # Artist / Title
+ VARIOUSARTISTSTYLE=forward
+ ;;
+ 2) # Artist - Title
+ VARIOUSARTISTSTYLE=forward-dash
+ ;;
+ 3) # Title / Artist
+ VARIOUSARTISTSTYLE=reverse
+ ;;
+ 4) # Title - Artist
+ VARIOUSARTISTSTYLE=reverse-dash
+ ;;
+ esac
+ fi
+
# This is temporarily commented out until I have a chance to mess with it a
# little more. --rcw 8/31/1999
#
@@ -616,6 +697,8 @@
ENCNICE=10
READNICE=10
INTERACTIVE=y
+VARIOUSARTISTS=n
+VARIOUSARTISTSTYLE=forward
# program paths - defaults to checking your $PATH
LAME=lame
@@ -870,6 +953,7 @@
TRACKNUM=$(printf %0.${TRACKNUMPADDING}d ${UTRACKNUM})
CDDBTRACKNUM=$(expr $UTRACKNUM - 1)
TRACKNAME=$(grep ^TTITLE$CDDBTRACKNUM= "$CDDBDATA" | head -1 | cut -f2 -d= | tr -d \[:cntrl:\])
+ splitvarious
if checkstatus ^encodetrack-$UTRACKNUM; then :; else do_encode $UTRACKNUM $LOCATION; fi
if checkstatus ^tagtrack-$UTRACKNUM; then :; else do_tag $UTRACKNUM; fi
if checkstatus ^movetrack-$UTRACKNUM; then :; else do_move $UTRACKNUM; fi
To unsubscribe: echo unsubscribe | mail abcde-request@whimsica.lly.org