Merge pull request #30 from Seirdy/fix/better-cover-file-discovery
Find more types of cover art files
This commit is contained in:
commit
a207ee23a5
19
kunst
19
kunst
|
@ -151,23 +151,30 @@ update_cover() {
|
||||||
fi
|
fi
|
||||||
ARTLESS=false
|
ARTLESS=false
|
||||||
else
|
else
|
||||||
DIR="$MUSIC_DIR$(dirname "$(mpc current -f %file%)")"
|
DIR="$MUSIC_DIR/$(dirname "$(mpc current -f %file%)")"
|
||||||
if [ ! $SILENT ];then
|
if [ ! $SILENT ];then
|
||||||
echo "kunst: inspecting $DIR"
|
echo "kunst: inspecting $DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if there is an album cover/art in the folder.
|
# Check if there is an album cover/art in the folder.
|
||||||
# Look at issue #9 for more details
|
# Look at issue #9 for more details
|
||||||
for CANDIDATE in "$DIR/cover."{png,jpg}; do
|
# use same regex to find album art as mpDris2
|
||||||
|
candidates=$(
|
||||||
|
find "$DIR" -type f \
|
||||||
|
| grep -iE '/(album|cover|\.?folder|front).*\.(gif|jpeg|jpg|png)'
|
||||||
|
)
|
||||||
|
while read -r CANDIDATE; do
|
||||||
if [ -f "$CANDIDATE" ]; then
|
if [ -f "$CANDIDATE" ]; then
|
||||||
STATUS=0
|
STATUS=0
|
||||||
ARTLESS=false
|
export ARTLESS=false
|
||||||
convert "$CANDIDATE" $COVER &> /dev/null
|
convert "$CANDIDATE" $COVER
|
||||||
|
ls -l $COVER
|
||||||
if [ ! $SILENT ];then
|
if [ ! $SILENT ];then
|
||||||
echo "kunst: found cover.png"
|
echo "kunst: found cover $CANDIDATE"
|
||||||
fi
|
fi
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done <<< "$candidates" # use here string so loop changes vars in main process
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $STATUS -ne 0 ];then
|
if [ $STATUS -ne 0 ];then
|
||||||
|
|
Loading…
Reference in New Issue