Add -O / OVERRIDEALBUMARTDOWNLOAD option master
authorSteve McIntyre <steve@einval.com>
Sun, 14 Feb 2021 17:58:14 +0000 (17:58 +0000)
committerSteve McIntyre <steve@einval.com>
Sun, 14 Feb 2021 17:58:14 +0000 (17:58 +0000)
abcde
abcde.1
abcde.conf

diff --git a/abcde b/abcde
index 7ea1f94..b53593a 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -52,6 +52,7 @@ echo "-o <type1[,type2]...>"
 echo "       Output file type(s), comma separated"
 echo "       (vorbis,mp3,flac,spx,mpc,wav,m4a,opus,mka,wv,ape,mp2,tta,aiff)."
 echo "       Defaults to vorbis"
+echo "-O     Allow Override of album art lookup"
 echo "-p     Pad track numbers with 0's (if less than 10 tracks)"
 echo "-P     Use UNIX pipes to read+encode without wav files"
 echo "-Q     CD lookup method(s), comma separated"
@@ -3278,27 +3279,30 @@ do_getalbumart()
                                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
+                       if [ ! -s "${ABCDETEMPDIR}/$ALBUMARTFILE" ] || \
+                                  [ "$OVERRIDEALBUMARTDOWNLOAD" = "y" ]; then
+                               echo -n "Do you want to enter URL or local path for the album art [y/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
+                               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
@@ -3814,6 +3818,7 @@ PLAYLISTDATAPREFIX=''
 VAPLAYLISTFORMAT='${ARTISTFILE}-${ALBUMFILE}.${OUTPUT}.m3u'
 VAPLAYLISTDATAPREFIX=''
 DOSPLAYLIST=n
+OVERRIDEALBUMARTDOWNLOAD=n
 COMMENT=''
 ID3TAGV=id3v2.4
 ENCNICE=10
@@ -4167,6 +4172,7 @@ while getopts 1a:bBc:C:d:DefgGhj:klLmMnNo:pPQ:r:s:S:t:T:UvVxX:w:W:z opt ; do
                m) DOSPLAYLIST=y ;;
                M) DOCUE=y ;;
                o) OUTPUTTYPE="$OPTARG" ;;
+               O) OVERRIDEALBUMARTDOWNLOAD=y ;;
                p) PADTRACKS=y ;;
                P) USEPIPES=y ;;
                Q) CDDBMETHOD="$OPTARG" ;;
diff --git a/abcde.1 b/abcde.1
index 74f38bc..c6cec80 100644 (file)
--- a/abcde.1
+++ b/abcde.1
@@ -165,6 +165,12 @@ to obtain all specified types.  See the OUTPUTTYPE configuration variable. One c
 pass options to the encoder for a specific filetype on the command line separating
 them with a colon. The options must be escaped with double-quotes.
 .TP
+.B \-O
+When fetching album art, always ask the user if they have a URL or
+local file to override whatever album art may have been automatically
+selected and downloaded. See the OVERRIDEALBUMARTDOWNLOAD
+configuration variable.
+.TP
 .B \-p
 Pads track numbers with 0\'s.
 .TP
index 3c6272a..930fdcd 100644 (file)
 #ALBUMARTFILE="cover.jpg"
 #ALBUMARTTYPE="JPEG"
 
+# Set to "y" to ask at runtime whether or not we should look for a
+# user-specified path/URL for cover art, overriding automatic lookup
+#OVERRIDEALBUMARTDOWNLOAD=n
+
 # 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