-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Package: abcde
Version: 2.3.99.6-1

More patches for abcde.

This set adds support for using the freedb2 cddb database:

  http://freedb2.org/

Using freedb2 required two changes:

1) cddb-tool was incorrectly sending backslash characters in the http
GET cgi string.  This appears to be due to incorrect escaping of the
ampersand signs "\&" when constructing the URL.  These backslashes were
likely needed at one time, but now the whole URL is in double quotes so
the backslash characters are sent as part of the query which causes the
freedb2 server to barf.

2) The do_cddbstat procedure was modified to recognize the freedb2
server, which does not support the stat command.  The ver command, and
pretty much everything else I tried was also not supported.  I
implemented a workaround that tries a normal cddb query command (using
disc-id info from the freedb TestCD) if the stat command fails.  If the
server replies with a 2xx response code, the cddb server is considered
to be alive and working.

To use, just set CDDBURL in abcde.conf:

  CDDBURL="http://freedb2.org:80/~cddb/cddb.cgi";

- --
Charles Steinkuehler
[EMAIL PROTECTED]

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (MingW32)

iD8DBQFFJC78enk4xp+mH40RAt8gAKDA2pQsLdlTKKVoSscrKPKelJrpYACgwMpf
vGZicga3QCYa8/eJCok7wX0=
=Ot5v
-----END PGP SIGNATURE-----
--- abcde.svn.mkcue	2006-09-29 10:14:19.407635831 -0500
+++ abcde.svn.freedb2	2006-10-04 16:44:57.457570805 -0500
@@ -2222,12 +2222,22 @@
 				RESPONSECODE=$(head -n 1 "$ABCDETEMPDIR/cddbstat" | cut -f1 -d' ')
 				case "$RESPONSECODE" in
 				210)    # 210 OK, status information follows (until terminating `.')
-					rc=0;
+					rc=0
 					;;
-				501|*)  # 501 Illegal CDDB protocol level: <n>. 
+				501)    # 501 Illegal CDDB protocol level: <n>. 
 					CDDBPROTO=`expr $CDDBPROTO - 1`
 					;;
-				esac 
+				*)	# Try a cddb query, since freedb2.org doesn't support the stat or ver commands
+					# FreeDB TESTCD disc-id is used for query
+					$CDDBTOOL query $CDDBURL $CDDBPROTO $CDDBUSER $CDDBHOST 03015501 1 296 344 > "$ABCDETEMPDIR/cddbstat"
+					RESPONSECODE=$(head -n 1 "$ABCDETEMPDIR/cddbstat" | cut -f1 -d' ')
+					case "$RESPONSECODE" in
+						2??)	# Server responded, everything seems OK
+							rc=0
+							;;
+					esac
+					;;
+				esac
 			done
 			if test $rc -eq 1; then
 				CDDBAVAIL="n" 
--- cddb-tool.svn	2006-10-04 16:43:56.866764731 -0500
+++ cddb-tool.svn.backslash	2006-10-04 16:44:19.777288388 -0500
@@ -208,7 +208,7 @@
 	shift 4
 	TRACKINFO="$@"
 	TRACKINFOPLUS=$(echo $TRACKINFO | tr ' ' '+')
-	RESULTS=$($HTTPGET "$SERVER?cmd=cddb+query+$TRACKINFOPLUS\&hello=$HELLOINFO\&proto=$PROTO") || exit $LOOKUP_ERR
+	RESULTS=$($HTTPGET "$SERVER?cmd=cddb+query+$TRACKINFOPLUS&hello=$HELLOINFO&proto=$PROTO") || exit $LOOKUP_ERR
 	echo "$RESULTS" | tr '\r' '\n' | tr -s '\n' | sed 's/^ //g'
 	;;
 
@@ -220,7 +220,7 @@
 	CATEGORY="$5"
 	DISCID="$6"
 	HELLOINFO="$USER+$HOST+$NAME+$VERSION"
-	$HTTPGET $CDDBDATA "$SERVER?cmd=cddb+read+$CATEGORY+$DISCID\&hello=$HELLOINFO\&proto=$PROTO" 2>/dev/null
+	$HTTPGET $CDDBDATA "$SERVER?cmd=cddb+read+$CATEGORY+$DISCID&hello=$HELLOINFO&proto=$PROTO" 2>/dev/null
 	;;
 
 stat) # cddb-tool stat serverurl user host proto
@@ -229,7 +229,7 @@
 	HOST="$3"
 	PROTO="$4"
 	HELLOINFO="$USER+$HOST+$NAME+$VERSION"
-	$HTTPGET $CDDBDATA "$SERVER?cmd=stat&hello=$HELLOINFO\&proto=$PROTO" 2>/dev/null
+	$HTTPGET $CDDBDATA "$SERVER?cmd=stat&hello=$HELLOINFO&proto=$PROTO" 2>/dev/null
 	;;
 
 help) # help

Reply via email to