From 71ca28742ac4f93ab2401eaee8e78471c023cd4b Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Thu, 7 Nov 2024 11:32:27 +0800 Subject: Update --- X11/mpd/ncmpcpp/cover_obs.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 X11/mpd/ncmpcpp/cover_obs.sh (limited to 'X11/mpd/ncmpcpp/cover_obs.sh') diff --git a/X11/mpd/ncmpcpp/cover_obs.sh b/X11/mpd/ncmpcpp/cover_obs.sh new file mode 100755 index 0000000..032bd08 --- /dev/null +++ b/X11/mpd/ncmpcpp/cover_obs.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +COVER="/tmp/album_cover.png" +COVER_SIZE="400" + +#path to current song +file="$MUSIC_DIR/$(mpc --format %file% current)" +album="${file%/*}" +#search for cover image +#use embedded image if present, otherwise take it from the current folder +err=$(ffmpeg -loglevel 16 -y -i "$file" -an -vcodec copy $EMB_COVER 2>&1) +if [ "$err" != "" ]; then + art=$(find "$album" -maxdepth 1 | grep -m 1 ".*\.\(jpg\|png\|gif\|bmp\)") +else + art=$EMB_COVER +fi +if [ "$art" = "" ]; then + art="$HOME/.ncmpcpp/default_cover.png" +fi +#copy and resize image to destination +ffmpeg -loglevel 0 -y -i "$art" -vf "scale=$COVER_SIZE:-1" "$COVER" \ No newline at end of file -- cgit v1.2.3-70-g09d2