From 4b5abb8a21658623be26e1ad03712e65cae5a415 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Tue, 28 Feb 2023 23:11:08 +0800 Subject: Add ncmpcpp layout ref: https://radumirea.com/blog/ncmpcpp-with-album-art --- mpd/ncmpcpp/cover_obs.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 mpd/ncmpcpp/cover_obs.sh (limited to 'mpd/ncmpcpp/cover_obs.sh') diff --git a/mpd/ncmpcpp/cover_obs.sh b/mpd/ncmpcpp/cover_obs.sh new file mode 100755 index 0000000..032bd08 --- /dev/null +++ b/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