diff options
Diffstat (limited to '.config/ncmpcpp/cover_obs.sh')
-rwxr-xr-x | .config/ncmpcpp/cover_obs.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/.config/ncmpcpp/cover_obs.sh b/.config/ncmpcpp/cover_obs.sh new file mode 100755 index 0000000..e6d80e0 --- /dev/null +++ b/.config/ncmpcpp/cover_obs.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env sh + +###################################################################### +# @author : pico (pico@$HOSTNAME) +# @file : cover_obs +# @created : Sunday Sep 08, 2024 00:52:58 CST +# +# @description : +###################################################################### + +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 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/.config/ncmpcpp/default_cover.png" +fi + +#copy and resize image to destination +ffmpeg -loglevel 0 -y -i "$art" -vf "scale=$COVER_SIZE:-1" "$COVER" |