BLURB="$1"
shift
case $BLURB in
- error) echo "[ERROR] abcde: $@" >&2 ;;
- warning) echo "[WARNING] $@" >&2 ;;
- info) echo "[INFO] $@" ;;
+ error) >&2 echo "[ERROR] abcde: $@" >&2 ;;
+ warning) >&2 echo "[WARNING] $@" >&2 ;;
+ info) >&4 echo "[INFO] $@" ;;
esac
}
fi
(
# These are from
- # http://www.xiph.org/ogg/vorbis/doc/v-comment.html
+ # http://www.xiph.org/vorbis/doc/v-comment.html
echo ARTIST="$TRACKARTIST"
echo ALBUM="$DALBUM"
echo GENRE="$CDGENRE"
fi
echo TRACKNUMBER=${TRACKNUM:-$1}
+ # TRACKTOTAL is not in the proposed, minimal list of standard field names from
+ # xiph.org: http://www.xiph.org/vorbis/doc/v-comment.html but is in common usage
+ # and read by mediainfo, ffprobe, vlc, Aqualung, ogg123, Foobar. And now abcde :)
+ # The tag is quietly ignored by Audacious, MPlayer, mpv, XMMS....
+ echo TRACKTOTAL="${TRACKS}"
if [ -n "$DISCNUMBER" ]; then
echo DISCNUMBER="$DISCNUMBER"
fi
echo GENRE="$CDGENRE"
fi
echo TRACKNUMBER="${TRACKNUM:-$1}"
+ # TRACKTOTAL is not in the proposed, minimal list of standard field names from
+ # xiph.org: http://www.xiph.org/vorbis/doc/v-comment.html but is in common usage
+ # and read by mediainfo, ffprobe, vlc, Aqualung, ogg123, Foobar. And now abcde :)
+ # The tag is quietly ignored by Audacious, MPlayer, mpv, XMMS....
+ echo TRACKTOTAL="${TRACKS}"
if [ -n "$DISCNUMBER" ]; then
echo DISCNUMBER="$DISCNUMBER"
fi
$HTTPGET "$ALBUMARTURL" > "$ABCDETEMPDIR/$ALBUMARTFILE"
if [ $? -ne 0 ]; then
vecho "could not download cover from amazon" >&2
+ else
+ # Check that size is reasonable; sometimes when there is no cover image
+ # on amazon.com a 1x1 pixel gif image will be downloaded instead:
+ FILESIZE=$(wc -c < "$ABCDETEMPDIR/$ALBUMARTFILE")
+ if [ "$FILESIZE" -lt 1024 ]; then
+ rm "$ABCDETEMPDIR/$ALBUMARTFILE"
+ vecho "could not download cover from amazon" >&2
+ fi
fi
else
vecho "no amazon ID found" >&2
if [ x"$EXTRAVERBOSE" != "x" ] && [ $EXTRAVERBOSE -gt 0 ] ; then
case $1 in
warning) shift ; log warning "$@" ;;
- *) echo "$@" ;;
+ *) >&4 echo "$@" ;;
esac
fi
}
if [ x"$EXTRAVERBOSE" != "x" ] && [ $EXTRAVERBOSE -gt 1 ] ; then
case $1 in
warning) shift ; log warning "$@" ;;
- *) echo "$@" ;;
+ *) >&4 echo "$@" ;;
esac
fi
}
if [ x"$DEBUG" != "x" ]; then
if echo $1 | grep "^\[" > /dev/null 2>&1 ; then
DEBUGECHO=$(echo "$@" | tr -d '[]')
- echo "[DEBUG] $DEBUGECHO: `eval echo \\$${DEBUGECHO}`"
+ echo >&4 "[DEBUG] $DEBUGECHO: `eval echo \\$${DEBUGECHO}`"
else
- echo "[DEBUG] $1"
+ echo >&4 "[DEBUG] $1"
fi
fi
}
# List of preferred cdromreaders - by default, run whichever we have in the path
DEFAULT_CDROMREADERS="cdparanoia icedax cdda2wav libcdio pird"
+# fd for when `vecho` and `log info` called with redirected stdout
+exec 4>&1
+
# Assume fetch if under FreeBSD. curl is used for Mac OS X. wget is used for
# Linux/OpenBSD. ftp is user for NetBSD.
# Let's use these checkings to determine the OS flavour, which will be used
if [ "$( eval echo "\$$PIPERIPPERSVARCHECK" )" = "$" ] || \
[ "$( eval echo "\$$PIPERIPPERSVARCHECK" )" = "" ] ; then
log error "no support for pipes with given ripper"
- log error "read the USEPIPES file from the source tarball to get help."
- log error "On a Debian system, it is under /usr/share/doc/abcde/USEPIPES.gz"
+ log error "read the FAQ file from the source tarball to get help."
exit 1;
fi
decho "PIPEENCODERSVARCHECK: $( eval echo "\$$PIPEENCODERSVARCHECK" )"
if [ "$( eval echo "\$$PIPEENCODERSVARCHECK" )" = "$" ] || \
[ "$( eval echo "\$$PIPEENCODERSVARCHECK" )" = "" ] ; then
log error "no support for pipes with given encoder"
- log error "read the USEPIPES file from the source tarball to help"
- log error "on a Debian system, read /usr/share/doc/abcde/USEPIPES.gz"
+ log error "read the FAQ file from the source tarball to get help"
exit 1;
fi
fi