[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[abcde] Re: 1.9.4




Hello,

> The Various Artists stuff is exactly as Kevin sent it to me - I plan to add
> some heuristics to the works before calling it good.

Well, here's my stab at some heuristics. Simply put, it checks the
disc title and if it starts with "various" (of varying capitalisation)
then assume Multi-artist, otherwise just ask (and assume not for
non-interactive).

Once the Various Artist designation is made, it tries to choose
between "Artist / Title" and "Artist - Title" by checking whether more
than 1/2 the track names contain a "/" or more than 1/2 the track
names contain a "-". I couldn't think of any good way of checking
which came first: Artist or Title, so there's room for improvement
there.

An override is then possible (to one particular format, or changing
one's mind and treating the disc as single artist).

One note is that I've noticed some players seem to support a "TARTIST"
keyword, which wasn't in the docs I have (DBFORMAT from Freedb.org's
server source). As such, that is not supported here... yet. For those
rare ones, I suggest editing the listing to be of a more standard
format for the time being.

Of course, please feel free to do any cleaning/rearranging that might
make everything nicer/smoother.

Cheers,

Kevin.

-- Attached file included as plaintext by Listar --

--- orig/abcde-1.9.4/abcde	Fri Sep 29 02:01:34 2000
+++ abcde/abcde	Tue Oct  3 11:46:46 2000
@@ -604,28 +604,56 @@
 			rm -f "$CDDBDATA~"
 		fi
 	fi	
-	
-	echo -n "Is the CD multi-artist? [y/n] (n): "
-	if [ "$INTERACTIVE" = "y" ]; then
-		read VARIOUSARTISTS
+
+	# Some heuristics first. Look at Disc Title, and if it starts with
+	# "Various", then we'll assume Various Artists
+	if [ "$(grep ^DTITLE= "$CDDBDATA" | cut -f2 -d= | grep -ci ^various)" != "0" ]; then
+		echo "Looks like a Multi-Artist CD"
+		VARIOUSARTISTS=y
 	else
-		echo n
-		VARIOUSARTISTS=n
+		echo -n "Is the CD multi-artist? [y/n] (n): "
+		if [ "$INTERACTIVE" = "y" ]; then
+			read VARIOUSARTISTS
+		else
+			echo n
+			VARIOUSARTISTS=n
+		fi
 	fi
 	if [ "$VARIOUSARTISTS" = "y" ]; then
+		# Set a default
+		DEFAULTSTYLE=1
+		# Need NUMTRACKS before cddb-tool will return it:
+		NUMTRACKS=$(grep -E '^TTITLE[0-9]+=' "$CDDBDATA" | wc -l)
+		if [ "$(grep -c "^TTITLE.*\/" "$CDDBDATA")" -gt "$(expr $NUMTRACKS / 2 )" ]; then
+			# More than 1/2 tracks contain a "/", so guess forward
+			DEFAULTSTYLE=1
+		elif [ "$(grep -c "^TTITLE.*\-" "$CDDBDATA")" -gt "$(expr $NUMTRACKS / 2 )" ]; then
+			# More than 1/2 contain a "-", so guess forward-dash
+			DEFAULTSTYLE=2
+		fi
 		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
+		echo "5) This is a single-artist CD"
+		echo -n "Which style of multiple artist entries is it? [1-5] ($DEFAULTSTYLE): "
+		if [ "$INTERACTIVE" = "y" ]; then
+			read VARIOUSARTISTSTYLE
+		else
+			echo $DEFAULTSTYLE
+			VARIOUSARTISTSTYLE=$DEFAULTSTYLE
+		fi
 		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]: "
+		# If they press Enter, then the default style (0) was chosen
+		while [ $VARIOUSARTISTSTYLE -lt 0 ] || [ $VARIOUSARTISTSTYLE -gt 5 ]; do
+			echo "Invalid selection. Please choose a number between 1 and 5."
+			echo -n "Selection [1-5]: "
 			read VARIOUSARTISTSTYLE
 			VARIOUSARTISTSTYLE=$(echo $VARIOUSARTISTSTYLE | xargs printf %d)
 		done
+		if [ "$VARIOUSARTISTSTYLE" = "0" ]; then
+			VARIOUSARTISTSTYLE=$DEFAULTSTYLE
+		fi
 		echo "Selected: $VARIOUSARTISTSTYLE"
 		case "$VARIOUSARTISTSTYLE" in
 		1) # Artist / Title
@@ -640,6 +668,9 @@
 		4) # Title - Artist
 			VARIOUSARTISTSTYLE=reverse-dash
 			;;
+		5) # Single Artist
+			VARIOUSARTISTS=n
+			;;
 		esac
 	fi
 	


To unsubscribe: echo unsubscribe | mail abcde-request@whimsica.lly.org