diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2023-02-28 23:11:08 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2023-02-28 23:32:17 +0800 |
commit | 4b5abb8a21658623be26e1ad03712e65cae5a415 (patch) | |
tree | dcf7511a6013c62d103d5bf92e2e2b83be180fec /mpd/ncmpcpp/cover_obs.sh | |
parent | fadb9706c50894058d71738d4dfc508c6922ee9a (diff) |
Add ncmpcpp layout
ref: https://radumirea.com/blog/ncmpcpp-with-album-art
Diffstat (limited to 'mpd/ncmpcpp/cover_obs.sh')
-rwxr-xr-x | mpd/ncmpcpp/cover_obs.sh | 21 |
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 | |||
3 | COVER="/tmp/album_cover.png" | ||
4 | COVER_SIZE="400" | ||
5 | |||
6 | #path to current song | ||
7 | file="$MUSIC_DIR/$(mpc --format %file% current)" | ||
8 | album="${file%/*}" | ||
9 | #search for cover image | ||
10 | #use embedded image if present, otherwise take it from the current folder | ||
11 | err=$(ffmpeg -loglevel 16 -y -i "$file" -an -vcodec copy $EMB_COVER 2>&1) | ||
12 | if [ "$err" != "" ]; then | ||
13 | art=$(find "$album" -maxdepth 1 | grep -m 1 ".*\.\(jpg\|png\|gif\|bmp\)") | ||
14 | else | ||
15 | art=$EMB_COVER | ||
16 | fi | ||
17 | if [ "$art" = "" ]; then | ||
18 | art="$HOME/.ncmpcpp/default_cover.png" | ||
19 | fi | ||
20 | #copy and resize image to destination | ||
21 | ffmpeg -loglevel 0 -y -i "$art" -vf "scale=$COVER_SIZE:-1" "$COVER" \ No newline at end of file | ||