Created
September 24, 2019 17:42
-
-
Save rien333/10060c0d43ba9aed0128f39a49c9133b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
[ $2 != "playing" ] && exit 0 | |
# file_path=$(echo "$@" | grep -o "file .*\...." | sed s/file\ //) # Does not always work? | |
# file_path=$(echo "$@" | sed -e 's/^.*file //; s/artist.*$//') # new sed command | |
file_path=$(echo "$@" | sed -e 's/.*file \(.*\) artist.*/\1/') # Experimental! | |
# try albumartist instead of artist | |
if [ "$file_path" = "$@" ] ;then | |
file_path=$(echo "$@" | sed -e 's/.*file \(.*\) albumartist.*/\1/') | |
fi | |
ffmpeg -y -i "${file_path}" -an -vcodec copy ~/.config/cmus/cmus-cover-art/.cover/cover.jpg | |
# cue files don't support embedded covers | |
if [ $? -ne 0 ]; then | |
# extract the first thing that looks like a path | |
cue=$(dirname "$(echo ${file_path} | grep -o '/\w.*')") | |
path=$(dirname "$cue") | |
cp "${path}"/*jpg ~/.config/cmus/cmus-cover-art/.cover/cover.jpg | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment