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

[abcde] Patches for abcde and *BSD



After abcde entered the FreeBSD ports collection some months ago, it
grew into the de-facto ripper on FreeBSD, and I hear it's the same for
the other BSDs. I have some patches here that make life easier for the
BSDs.

The first one makes abcde use 'jot' instead of 'seq', as jot is
supported by our minimal sh implementations. Furthermore, it adds
support for 'dagrab' and 'fetch', though it uses dagrab by default
(which abcde doesn't need to) and removes wget support in favour of
'fetch' (which abcde once again really shouldn't). It would be nice to
have support for these things though.

The second patch modifies cddb-tool to use jot and fetch, instead of seq
and wget. It would be *really* nice if they could make it into abcde
(though of course the default encoder/fetcher/etc. shouldn't change).

FWIW, it's nice to see, for instance, the patch posted by Ben Finney for
FLAC support too.

Anyway, here goes:

--- abcde.orig	Mon Aug  5 16:56:33 2002
+++ abcde	Mon Aug  5 16:53:52 2002
@@ -534,7 +534,7 @@
 				;;
 				12|13|14)
 					# no match found in database,
-					# wget error, or user requested not to use CDDB
+					# fetch error, or user requested not to use CDDB
 					# Make up an error code (503) that abcde
 					# will recognize in do_cddbread
 					# and compensate by making a template
@@ -574,7 +574,7 @@
 			fi
 			# List out disc title/author and contents
 			echo ---- "$(cut '-d ' -f4- "$ABCDETEMPDIR/cddbquery")" ---- >> "$ABCDETEMPDIR/cddbchoices"
-			for TRACK in $(seq 1 $TRACKS)
+			for TRACK in $(jot $TRACKS)
 			do
 				echo $TRACK: "$(grep ^TTITLE$(expr $TRACK - 1)= "$ABCDETEMPDIR/cddbread.1" | cut -f2- -d= | tr -d \\r\\n)" >> "$ABCDETEMPDIR/cddbchoices"
 			done
@@ -590,7 +590,7 @@
 			$CDDBTOOL template $(cat "$ABCDETEMPDIR/discid") > "$ABCDETEMPDIR/cddbread.1"
 			# List out disc title/author and contents of template
 			echo ---- Unknown Artist / Unknown Album ---- >> "$ABCDETEMPDIR/cddbchoices"
-			for TRACK in $(seq 1 $TRACKS)
+			for TRACK in $(jot $TRACKS)
 			do
 				echo $TRACK: "$(grep ^TTITLE$(expr $TRACK - 1)= "$ABCDETEMPDIR/cddbread.1" | cut -f2- -d= | tr -d \\r\\n)" >> "$ABCDETEMPDIR/cddbchoices"
 			done
@@ -620,7 +620,7 @@
 				fi
 				# List out disc title/author and contents
 				echo \#$X: ---- "$DISCINFO" ---- >> "$ABCDETEMPDIR/cddbchoices"
-				for TRACK in $(seq 1 $TRACKS)
+				for TRACK in $(jot $TRACKS)
 				do
 					echo $TRACK: "$(grep ^TTITLE$(expr $TRACK - 1)= "$ABCDETEMPDIR/cddbread.$X" | cut -f2- -d= | tr -d \\r\\n)" >> "$ABCDETEMPDIR/cddbchoices"
 				done
@@ -866,7 +866,8 @@
 	case "$CDROMREADERSYNTAX" in
 		cdparanoia) nice $READNICE $CDROMREADER -d $CDROM $UTRACKNUM "$WAVDATA" >&2 ;;
 		cdda2wav) nice $READNICE $CDROMREADER -H -D $CDROM -t $UTRACKNUM "$WAVDATA" >&2 ;;
-		debug) nice $READNICE $CDROMREADER -d $CDROM -w $UTRACKNUM-[:1] "$WAVDATA" >&2 ;;
+		dagrab) nice $READNICE $CDROMREADER -d $CDROM -f $WAVDATA -v $UTRACKNUM >&2 ;;
+        debug) nice $READNICE $CDROMREADER -d $CDROM -w $UTRACKNUM-[:1] "$WAVDATA" >&2 ;;
 	esac
 	RETURN=$?
 	if [ "$RETURN" != "0" ]; then
@@ -886,7 +887,7 @@
 CDDBSUBMIT=freedb-submit@freedb.org
 HELLOINFO="$(whoami)@$(hostname)"
 INTERACTIVE=y
-CDROMREADERSYNTAX=cdparanoia
+CDROMREADERSYNTAX=dagrab
 OUTPUTTYPE=ogg
 ENCODERSYNTAX=default
 OUTPUTFORMAT='${ARTISTFILE}/${TRACKFILE}.$OUTPUTTYPE'
@@ -913,7 +914,8 @@
 ID3V2=id3v2
 CDPARANOIA=cdparanoia
 CDDA2WAV=cdda2wav
-WGET=wget
+DAGRAB=dagrab
+FETCH=fetch
 CDDISCID=cd-discid
 CDDBTOOL=cddb-tool
 EJECT=eject
@@ -933,7 +935,8 @@
 ID3V2OPTS=
 CDPARANOIAOPTS=
 CDDA2WAVOPTS=
-WGETOPTS=
+DAGRABOPTS=
+FETCHOPTS=
 CDDBTOOLOPTS=
 EJECTOPTS=
 DISTMP3OPTS=
@@ -1010,7 +1013,7 @@
 	if [ "$RSTART" = "$REND" ]; then 
 		NEWTRACKS="$RSTART"
 	else
-		NEWTRACKS=$(seq -s ' ' $RSTART $REND)
+		NEWTRACKS=$(jot -s ' ' $(($REND - $RSTART + 1)) $RSTART $REND``)
 	fi
 	TRACKQUEUE=$(echo "$TRACKQUEUE" "$NEWTRACKS")
 
@@ -1027,6 +1030,9 @@
 		CDROMREADER="$CDDA2WAV"
 		CDROMREADEROPTS="$CDDA2WAVOPTS"
 		;;
+    dagrab)
+        CDROMREADER="$DAGRAB"
+        CDROMREADEROPTS="$DAGRABOPTS"
 esac
 
 # If nothing has been specified, use oggenc for oggs and lame for mp3s
@@ -1100,8 +1106,8 @@
 if [ "$OUTPUTTYPE" = "ogg" ]; then NEEDCOMMENTER=y; fi
 
 # Make sure a buncha things exist
-for X in $CDROMREADER $CDDISCID ${NEEDTAGGER+$TAGGER} $ENCODER $WGET \
-	${NEEDDISTMP3+$DISTMP3} ${NEEDCOMMENTER+$VORBISCOMMENT} seq
+for X in $CDROMREADER $CDDISCID ${NEEDTAGGER+$TAGGER} $ENCODER $FETCH \
+	${NEEDDISTMP3+$DISTMP3} ${NEEDCOMMENTER+$VORBISCOMMENT} jot
 do
 	# Cut off the command-line options we just added in
 	X=$(echo $X | cut -d' ' -f2)
@@ -1191,7 +1197,7 @@
 # Figure out where each track is going to be encoded
 ENCODELOCATIONS="$(echo $REMOTEHOSTS | tr , ' ')"
 if [ "$MAXPROCS" != "0" ]; then
-	for NUM in $(seq 1 "$MAXPROCS")
+	for NUM in $(jot "$MAXPROCS")
 	do
 		ENCODELOCATIONS="$ENCODELOCATIONS %local$NUM%"
 	done


...and the second patch:

--- cddb-tool.orig	Mon Jan 21 03:29:23 2002
+++ cddb-tool	Thu Oct 31 19:41:23 2002
@@ -30,9 +30,9 @@
 LOOKUP_ERR=13      # problem connecting to cddb server
 EMPTY_QUERY_RESPONSE=14	# query response = "", (probably no net connection)
 
-# assume a reasonable default if $WGET is undefined
-if [ "$WGET" = "" ]; then
-	WGET=wget
+# assume a reasonable default if $FETCH is undefined
+if [ "$FETCH" = "" ]; then
+	FETCH=fetch
 fi
 
 usage() {
@@ -74,8 +74,8 @@
   read server user host disc-id genre
 	CDDB file is dumped to stdout. File will contain an extra
 	#CATEGORY= line, which leaves it a valid CDDB file but which will
-	be recognized by parse and send commands. Uses wget, so if you
-	need to use a proxy then just configure wget to do so. user and
+	be recognized by parse and send commands. Uses fetch, so if you
+	need to use a proxy then just configure fetch to do so. user and
 	host will be used for identifying ourselves to the CDDB server.
   help  
 	Display this.
@@ -119,7 +119,7 @@
 	echo '#'
 	echo '# Track frame offsets:'
 	NUMTRACKS=$2
-	for x in $(seq 3 $(expr $NUMTRACKS + 2))
+	for x in $(jot $NUMTRACKS 3 $(expr $NUMTRACKS + 2))
 	do
 		printf "#\t$(echo "$DISCID" | cut -f$x -d' ')\n"
 	done
@@ -135,13 +135,13 @@
 	echo DISCID="$DISCNUM"
 	echo "DTITLE=Unknown Artist / Unknown Album"
 	# TTITLE0 -- TTITLEn
-	for x in $(seq 1 $NUMTRACKS)
+	for x in $(jot $NUMTRACKS)
 	do
 		echo "TTITLE$(expr $x - 1)=Track $x"
 	done
 	echo "EXTD="
 	# EXTT0 -- EXTTn
-	for x in $(seq 1 $NUMTRACKS)
+	for x in $(jot $NUMTRACKS)
 	do
 		echo "EXTT$(expr $x - 1)="
 	done
@@ -164,7 +164,7 @@
 	shift 3
 	TRACKINFO="$@"
 	TRACKINFOPLUS=$(echo $TRACKINFO | tr ' ' '+')
-	RESULTS=$($WGET -q -O - "$SERVER?cmd=cddb+query+$TRACKINFOPLUS\&hello=$HELLOINFO\&proto=3") || exit $LOOKUP_ERR
+	RESULTS=$($FETCH -q -o - "$SERVER?cmd=cddb+query+$TRACKINFOPLUS\&hello=$HELLOINFO\&proto=3") || exit $LOOKUP_ERR
 	echo $RESULTS | tr '\r' '\n' | tr -s '\n' | sed 's/^ //g'
 	;;
 
@@ -175,7 +175,7 @@
 	CATEGORY="$4"
 	DISCID="$5"
 	HELLOINFO="$USER+$HOST+$NAME+$VERSION"
-	$WGET -q -O - $CDDBDATA "$SERVER?cmd=cddb+read+$CATEGORY+$DISCID\&hello=$HELLOINFO\&proto=3" 2>/dev/null
+	$FETCH -q -o - $CDDBDATA "$SERVER?cmd=cddb+read+$CATEGORY+$DISCID\&hello=$HELLOINFO\&proto=3" 2>/dev/null
 	;;
 
 	help) help ;;


I hope this is useful.

Thanks for a great tool!

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