aboutsummaryrefslogtreecommitdiffhomepage
path: root/mpd/ncmpcpp/cover_obs.sh
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2023-02-28 23:11:08 +0800
committerHsieh Chin Fan <pham@topo.tw>2023-02-28 23:32:17 +0800
commit4b5abb8a21658623be26e1ad03712e65cae5a415 (patch)
treedcf7511a6013c62d103d5bf92e2e2b83be180fec /mpd/ncmpcpp/cover_obs.sh
parentfadb9706c50894058d71738d4dfc508c6922ee9a (diff)
Add ncmpcpp layout
ref: https://radumirea.com/blog/ncmpcpp-with-album-art
Diffstat (limited to 'mpd/ncmpcpp/cover_obs.sh')
-rwxr-xr-xmpd/ncmpcpp/cover_obs.sh21
1 files changed, 21 insertions, 0 deletions
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 @@
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