Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recognize more cover art names and allow user configuration #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions kunst
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,25 @@ find_album_art(){
ARTLESS=false
else
DIR="$MUSIC_DIR$(dirname "$(mpc current -f %file%)")"

# prevent iterating the entire $MUSIC_DIR if mpc experiences an error
[ "$DIR" == "$MUSIC_DIR". ] && return 1

[ ! "$SILENT" ] && echo "kunst: inspecting $DIR"

# Check if there is an album cover/art in the folder.
# Look at issue #9 for more details
for CANDIDATE in "$DIR/cover."{png,jpg}; do
COVER_NAMES=${KUNST_COVER_NAMES:-'folder|cover|front'}
COVER_EXT=${KUNST_COVER_EXT:-'jpg|png'}

# Check if there is an album cover/art in the folder.
# Look at issues #9 and #45 for more details
while IFS= read -r CANDIDATE; do
if [ -f "$CANDIDATE" ]; then
STATUS=0
ARTLESS=false
convert "$CANDIDATE" $COVER &> /dev/null
[ ! "$SILENT" ] && echo "kunst: found cover.png"
[ ! "$SILENT" ] && echo "kunst: found $(basename "$CANDIDATE")"
fi
done
done < <(find "$DIR" -type f | grep -i -E -- "($COVER_NAMES).($COVER_EXT)")
fi

if [ "$STATUS" -ne 0 ];then
Expand Down