Remove debian/conffiles - it is not needed
[abcde.git] / cddb-tool
index 0c9274c..bdd9613 100755 (executable)
--- a/cddb-tool
+++ b/cddb-tool
@@ -21,7 +21,7 @@
 #  - Submitted via: line is created by template, when it really should be in send.
 #    Oh well.
 
-VERSION=0.4.6
+VERSION=0.4.7
 NAME=cddb-tool
 
 #return codes
@@ -38,13 +38,13 @@ if [ "$HTTPGET" = "" ]; then
                HTTPGETOPTS=${HTTPGETOPTS:="-q -o -"}
        elif [ X"$(uname)" = X"NetBSD" ] ; then
                HTTPGET=ftp
-               HTTPGETOPTS=${HTTPGETOPTS:="-q -o -"}
+               HTTPGETOPTS=${HTTPGETOPTS:="-a -V -o - "}
        elif [ X"$(uname)" = X"Darwin" ] ; then
                HTTPGET=curl
                HTTPGETOPTS=${HTTPGETOPTS:="-f -s"}
        else
                HTTPGET=wget
-               HTTPGETOPTS=${HTTPGETOPTS:="-q -O -"}
+               HTTPGETOPTS=${HTTPGETOPTS:="-q -nv -e timestamping=off -O -"}
        fi
 fi
 
@@ -122,10 +122,10 @@ parse)    # takes 1 argument, a filename, and dumps out a sh parseable version
        set -e
        # names chosen to match usage in abcde code
        DISCID=$(grep ^DISCID= "$CDDBFILE" | cut -f2 -d= | tr -d \[:cntrl:\])
-       DARTISTALBUM=$(grep ^DTITLE= "$CDDBFILE" | cut -f2- -d= | tr -d \\n | sed 's- / -~-g' | tr -d \[:cntrl:\])
-       DARTIST=$(echo "$DARTISTALBUM" | cut -f1 -d~ | sed 's,\\,\\\\,g;s,\([\"\$\`]\),\\\1,g' | tr -d \[:cntrl:\])
-       DALBUM=$(echo "$DARTISTALBUM" | cut -f2 -d~ | sed 's,\\,\\\\,g;s,\([\"\$\`]\),\\\1,g' | tr -d \[:cntrl:\])
-       CDDBGENRE=$(grep '^#CATEGORY=' "$CDDBFILE" | cut -f2- -d= | tr -d \[:cntrl:\])
+       DARTISTALBUM="$(grep ^DTITLE= "$CDDBFILE" | cut -f2- -d= | tr -d \\n | sed 's- / -~-g' | tr -d \[:cntrl:\])"
+       DARTIST="$(echo "$DARTISTALBUM" | cut -f1 -d~ | sed 's,\\,\\\\,g;s,\([\"\$\`]\),\\\1,g' | tr -d \[:cntrl:\])"
+       DALBUM="$(echo "$DARTISTALBUM" | cut -f2 -d~ | sed 's,\\,\\\\,g;s,\([\"\$\`]\),\\\1,g' | tr -d \[:cntrl:\])"
+       CDDBGENRE="$(grep '^#CATEGORY=' "$CDDBFILE" | cut -f2- -d= | tr -d \[:cntrl:\])"
        if grep "^DYEAR" "$CDDBFILE" 2>&1 > /dev/null ; then
                CDYEAR=$(grep "^DYEAR" "$CDDBFILE" | cut -f2- -d= | tr -d \[:cntrl:\])
        elif grep YEAR "$CDDBFILE" 2>&1 > /dev/null ; then
@@ -196,7 +196,7 @@ send) # cddb-tool send filename email@address
        ADDRESS="$2"
        DISCID=$(grep ^DISCID= "$FILE" | cut -f2 -d= | tr -d \[:cntrl:\])
        CDDBGENRE=$(grep '^#CATEGORY=' "$FILE" | cut -f2- -d= | tr -d \[:cntrl:\])
-       grep -v "^#CATEGORY=" "$FILE" | mail -s "cddb $CDDBGENRE $DISCID" "$ADDRESS"
+       grep -v "^#CATEGORY=" "$FILE" | iconv -t utf-8 | mail -a "Content-Type: text/plain; charset=utf-8" -s "cddb $CDDBGENRE $DISCID" "$ADDRESS"
        ;;
 
 query) # cddb-tool query serverurl proto user host discid...
@@ -209,7 +209,7 @@ query) # cddb-tool query serverurl proto user host discid...
        TRACKINFO="$@"
        TRACKINFOPLUS=$(echo $TRACKINFO | tr ' ' '+')
        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'
+       echo "$RESULTS" | tr '\r' '\n' | tr -s '\n' | sed 's/^ //g'
        ;;
 
 read) # cddb-tool read serverurl proto user host genre discnumber