Push the rest of the do_getalbumart() resume changes
authorSteve McIntyre <steve@einval.com>
Mon, 5 Mar 2018 00:26:18 +0000 (00:26 +0000)
committerSteve McIntyre <steve@einval.com>
Mon, 5 Mar 2018 00:26:18 +0000 (00:26 +0000)
abcde

diff --git a/abcde b/abcde
index ba53e8c..bf822c5 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -3266,50 +3266,50 @@ do_getalbumart()
                                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" ] || [ "$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" >&2
-                               vecho "without ImageMagick convert" >&2
+               # 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" ] || [ "$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" >&2
+                                       vecho "without ImageMagick convert" >&2
+                               fi
                        fi
                fi
-       fi
-       # copy to target directories
-       if [ -s "${ABCDETEMPDIR}/$ALBUMARTFILE" ]; then
-               for OUTPUT in $(echo "$OUTPUTTYPE" | tr , \ )
-               do
-                       # put cover in the same place as the album
-                       if [ "$ONETRACK" = "y" ] ; then
-                               if [ "$VARIOUSARTISTS" = "y" ] ; then
-                                       ALBUMARTDIR="$(eval echo "$VAONETRACKOUTPUTFORMAT")"
+               # copy to target directories
+               if [ -s "${ABCDETEMPDIR}/$ALBUMARTFILE" ]; then
+                       for OUTPUT in $(echo "$OUTPUTTYPE" | tr , \ )
+                       do
+                               # put cover in the same place as the album
+                               if [ "$ONETRACK" = "y" ] ; then
+                                       if [ "$VARIOUSARTISTS" = "y" ] ; then
+                                               ALBUMARTDIR="$(eval echo "$VAONETRACKOUTPUTFORMAT")"
+                                       else
+                                               ALBUMARTDIR="$(eval echo "$ONETRACKOUTPUTFORMAT")"
+                                       fi
                                else
-                                       ALBUMARTDIR="$(eval echo "$ONETRACKOUTPUTFORMAT")"
-                       fi
+                                       if [ "$VARIOUSARTISTS" = "y" ] ; then
+                                               ALBUMARTDIR="$(eval echo "$VAOUTPUTFORMAT")"
+                                       else
+                                               ALBUMARTDIR="$(eval echo "$OUTPUTFORMAT")"
+                                       fi
+                               fi
+                               FINALALBUMARTDIR="$(dirname "$OUTPUTDIR/$ALBUMARTDIR")"
+                               vecho "copying cover to target directory $FINALALBUMARTDIR" >&2
+                               mkdir -p "$FINALALBUMARTDIR"
+                               cp "${ABCDETEMPDIR}/$ALBUMARTFILE" "$FINALALBUMARTDIR"
+                       done
+                       rm -f "${ABCDETEMPDIR}/$ALBUMARTFILE"
+                       echo "get-album-art=$ALBUMARTURL" >> "${ABCDETEMPDIR}/status"
                else
-                       if [ "$VARIOUSARTISTS" = "y" ] ; then
-                               ALBUMARTDIR="$(eval echo "$VAOUTPUTFORMAT")"
-                       else
-                               ALBUMARTDIR="$(eval echo "$OUTPUTFORMAT")"
-                       fi
+                       log warning "could not get cover"
+                       echo "get-album-art=none" >> "${ABCDETEMPDIR}/status"
                fi
-                       FINALALBUMARTDIR="$(dirname "$OUTPUTDIR/$ALBUMARTDIR")"
-                       vecho "copying cover to target directory $FINALALBUMARTDIR" >&2
-                       mkdir -p "$FINALALBUMARTDIR"
-                       cp "${ABCDETEMPDIR}/$ALBUMARTFILE" "$FINALALBUMARTDIR"
-               done
-               rm -f "${ABCDETEMPDIR}/$ALBUMARTFILE"
-               echo "get-album-art=$ALBUMARTURL" >> "${ABCDETEMPDIR}/status"
-       else
-               log warning "could not get cover"
-               echo "get-album-art=none" >> "${ABCDETEMPDIR}/status"
        fi
 }