diff options
Diffstat (limited to '.config/cmus/cover-art/observe.sh')
-rw-r--r-- | .config/cmus/cover-art/observe.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/.config/cmus/cover-art/observe.sh b/.config/cmus/cover-art/observe.sh new file mode 100644 index 0000000..5777f6c --- /dev/null +++ b/.config/cmus/cover-art/observe.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +CURRENT_DIR=`dirname "$BASH_SOURCE"` +COVERS_DIR="$CURRENT_DIR/.cover" + +status=$2 +file_path=$(echo "$@" | grep -o "file .*\...." | sed s/file\ //) +timestamp=`date +%s` + +rm $COVERS_DIR/* +if [ $status == "playing" ] +then + ffmpeg -i "${file_path}" -an -vcodec copy $COVERS_DIR/${timestamp}.jpg + if [ ! -f "$COVERS_DIR/${timestamp}.jpg" ] + then + file_dir=$(dirname "${file_path}") + cp "${file_dir}/cover.jpg" $COVERS_DIR/${timestamp}.jpg || cp "${file_dir}/folder.jpg" $COVERS_DIR/${timestamp}.jpg + fi +fi + |