diff options
| author | ivan-boikov <ik.boikov.public@protonmail.com> | 2024-08-18 19:20:32 +0200 |
|---|---|---|
| committer | ivan-boikov <ik.boikov.public@protonmail.com> | 2024-08-18 19:20:32 +0200 |
| commit | 63d1a6b8b17cbcec7aeae2f65a468eeca670271c (patch) | |
| tree | f111d6d01b90d9655a325237be68a3e8b94a9636 /scripts | |
| parent | 15b0c61c821bc66da75dfca3a81b5d903fd0eb58 (diff) | |
ncmpcpp: update cover to tmp
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/.local/bin/on_song_change | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/.local/bin/on_song_change b/scripts/.local/bin/on_song_change new file mode 100755 index 0000000..243d706 --- /dev/null +++ b/scripts/.local/bin/on_song_change @@ -0,0 +1,14 @@ +#!/bin/bash + +# https://gist.github.com/vlevit/4588882 +MUSIC_DIR="$HOME/audio/music" +album="$(mpc --format %album% current)" +file="$(mpc --format %file% current)" +album_dir="${file%/*}" +[[ -z "$album_dir" ]] && exit 1 +album_dir="$MUSIC_DIR/$album_dir" + +covers="$(find "$album_dir" -type d -exec find {} -maxdepth 1 -type f -iregex ".*/.*\(${album}\|cover\|folder\|artwork\|front\).*[.]\(jpe?g\|png\|gif\|bmp\)" \; )" +cover="$(echo -n "$covers" | head -n1)" + +cp -f "$cover" /tmp/mpd.cover |
