diff options
author | Cristian Cezar Moisés <[email protected]> | 2024-08-26 01:55:09 +0000 |
---|---|---|
committer | Cristian Cezar Moisés <[email protected]> | 2024-08-26 01:55:09 +0000 |
commit | 290e2313c119bd4a1dd8ff8f18d23eb98aa8580c (patch) | |
tree | d5f3939677143c2c967328515196d7f62ecb91fb /.config/cmus/cover-art/observe.sh | |
parent | bf23f3a1e3928949b6c033de724c7dd88df85a44 (diff) |
Upload files to ".config/cmus/cover-art"
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 + |