# set variables
ALBUMFILE="$(mungefilename "$DALBUM")"
ARTISTFILE="$(mungefilename "$DARTIST")"
- # cover file name
- if [ x"$ALBUMARTFILE" = "x" ]; then
- ALBUMARTFILE="cover.jpg"
- fi
# have we got a musicbrainz mbid or amazon asin?
case "$CDDBMETHOD" in
musicbrainz)
ALBUMARTURL="glyrc"
fi
fi
+ if [ "$INTERACTIVE" = "y" ]; then
+ if [ -s "$ABCDETEMPDIR/$ALBUMARTFILE" ]; then
+ # display properties of coverart when identify is available
+ if new_checkexec $IDENTIFY; then
+ $IDENTIFY $IDENTIFYOPTS "$ABCDETEMPDIR/$ALBUMARTFILE" >&2
+ fi
+ # display coverart when DISPLAY is set and display command is available
+ if new_checkexec $DISPLAYCMD && [ "$DISPLAY" != "" ]; then
+ $DISPLAYCMD $DISPLAYCMDOPTS "$ABCDETEMPDIR/$ALBUMARTFILE" >&2 &
+ fi
+ else
+ # nothing downloaded yet
+ vecho "automatic album art downloading failed" >&2
+ fi
+ # see if the user can find a better album art manually
+ echo -n "Do you want to enter URL or local path for the album art [y/N]? " >&2
+ read YESNO
+ while [ "$YESNO" != "y" ] && [ "$YESNO" != "n" ] && [ "$YESNO" != "Y" ] && \
+ [ "$YESNO" != "N" ] && [ "$YESNO" != "" ]
+ do
+ echo -n 'Invalid selection. Please answer "y" or "n": ' >&2
+ read YESNO
+ done
+ if [ "$YESNO" = "y" ] || [ "$YESNO" = "Y" ]; then
+ echo -n "Enter URL or local path (ENTER to cancel) :" >&2
+ read ALBUMARTURL
+ if [ ! -z "$ALBUMARTURL" ]; then
+ if [[ ${ALBUMARTURL} =~ (https?|ftp|file)://.* ]]; then
+ $HTTPGET "$ALBUMARTURL" > "$ABCDETEMPDIR/$ALBUMARTFILE"
+ if [ ! -s "$ABCDETEMPDIR/$ALBUMARTFILE" ]; then
+ vecho "unable to download $ALBUMARTURL" >&2
+ fi
+ else # it's a local path
+ cp "$ALBUMARTURL" "$ABCDETEMPDIR/$ALBUMARTFILE"
+ if [ ! -s "$ABCDETEMPDIR/$ALBUMARTFILE" ]; then
+ vecho "unable to copy $ALBUMARTURL to $ABCDETEMPDIR/$ALBUMARTFILE" >&2
+ fi
+ fi
+ fi
+ fi
+ fi
+ # convert to ALBUMARTTYPE if ImageMagick is available, if not assume correct type
+ if [ -s "$ABCDETEMPDIR/$ALBUMARTFILE" ] && new_checkexec $IDENTIFY; then
+ ALBUMARTURLTYPE=$($IDENTIFY "$ABCDETEMPDIR/$ALBUMARTFILE" | cut -d' ' -f2)
+ if [ "$ALBUMARTURLTYPE" != "$ALBUMARTTYPE" -o "$ALBUMARTALWAYSCONVERT" = "y" ]; then
+ if new_checkexec $CONVERT; then
+ mv "$ABCDETEMPDIR/$ALBUMARTFILE" "$ABCDETEMPDIR/$ALBUMARTFILE.tmp"
+ $CONVERT "$ABCDETEMPDIR/$ALBUMARTFILE.tmp" $CONVERTOPTS "$ABCDETEMPDIR/$ALBUMARTFILE"
+ rm -f "$ABCDETEMPDIR/$ALBUMARTFILE.tmp"
+ else
+ rm -f "$ABCDETEMPDIR/$ALBUMARTFILE"
+ vecho "sorry, cannot convert $ALBUMARTURLTYPE to $ALBUMARTTYPE without ImageMagick convert" >&2
+ fi
+ fi
+ fi
# copy to target directories
if [ -s "$ABCDETEMPDIR/$ALBUMARTFILE" ]; then
for OUTPUT in $(echo $OUTPUTTYPE | tr , \ )
DIFF=diff
CUE2DISCID=builtin
GLYRC=glyrc
+IDENTIFY=identify
+CONVERT=convert
+DISPLAYCMD=display
# Options for programs called from abcde
# mp3
VORBISCOMMENTOPTS="-R"
METAFLACOPTS="--no-utf8-convert"
DIFFOPTS=
-GLYRCOPTS="--formats jpg;jpeg"
+GLYRCOPTS=
+IDENTIFYOPTS=
+CONVERTOPTS=
+DISPLAYCMDOPTS="-resize 512x512 -title abcde_album_art"
+
+# Defaults for album art downloads
+ALBUMARTFILE="cover.jpg"
+ALBUMARTTYPE="JPEG"
+ALBUMARTALWAYSCONVERT="n"
# Default to one process if -j isn't specified
MAXPROCS=1
#WVGAIN=wvgain
#APETAG=apetag
#GLYRC=glyrc
+#IDENTIFY=identify
+#CONVERT=convert
+#DISPLAYCMD=display
# Options to call programs with:
# album art download options (see glyrc's help for details with more detailed
# examples here: https://github.com/sahib/glyr/wiki/Commandline-arguments).
+# For example use '--formats jpg;jpeg' to only search for JPEG images
# These options: '--from <provider>' and '--lang <langcode>' might also be useful
-#GLYRCOPTS="--formats jpg;jpeg"
+#GLYRCOPTS=
#ALBUMARTFILE="cover.jpg"
+#ALBUMARTTYPE="JPEG"
+
+# Options for ImageMagick commands used by album art processing when available
+# For example: CONVERTOPTS="-colorspace RGB -resize 600x600>"
+# to make the image RGB and fit inside 600x600 while keeping the aspect ratio
+#IDENTIFYOPTS=
+#CONVERTOPTS=
+#DISPLAYCMDOPTS="-resize 512x512 -title abcde_album_art"
+# By default convert is only called when the image type is different from
+# ALBUMARTTYPE, use ALBUMARTALWAYSCONVERT="y" to always call convert
+#ALBUMARTALWAYSCONVERT="n"
# Custom filename munging:
# By default, abcde will do the following to CDDB data to get a useful