aboutsummaryrefslogtreecommitdiffhomepage
path: root/X11/mpd/ncmpcpp/cover_obs.sh
diff options
context:
space:
mode:
Diffstat (limited to 'X11/mpd/ncmpcpp/cover_obs.sh')
-rwxr-xr-xX11/mpd/ncmpcpp/cover_obs.sh21
1 files changed, 21 insertions, 0 deletions
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 @@
1#!/bin/bash
2
3COVER="/tmp/album_cover.png"
4COVER_SIZE="400"
5
6#path to current song
7file="$MUSIC_DIR/$(mpc --format %file% current)"
8album="${file%/*}"
9#search for cover image
10#use embedded image if present, otherwise take it from the current folder
11err=$(ffmpeg -loglevel 16 -y -i "$file" -an -vcodec copy $EMB_COVER 2>&1)
12if [ "$err" != "" ]; then
13 art=$(find "$album" -maxdepth 1 | grep -m 1 ".*\.\(jpg\|png\|gif\|bmp\)")
14else
15 art=$EMB_COVER
16fi
17if [ "$art" = "" ]; then
18 art="$HOME/.ncmpcpp/default_cover.png"
19fi
20#copy and resize image to destination
21ffmpeg -loglevel 0 -y -i "$art" -vf "scale=$COVER_SIZE:-1" "$COVER" \ No newline at end of file