From 290e2313c119bd4a1dd8ff8f18d23eb98aa8580c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Cezar=20Mois=C3=A9s?= Date: Mon, 26 Aug 2024 01:55:09 +0000 Subject: Upload files to ".config/cmus/cover-art" --- .config/cmus/cover-art/observe.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .config/cmus/cover-art/observe.sh (limited to '.config/cmus/cover-art/observe.sh') 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 + -- cgit v1.2.3