diff options
author | katherine <shmibs@shmibbles.me> | 2016-02-01 22:45:25 -0700 |
---|---|---|
committer | katherine <shmibs@shmibbles.me> | 2016-02-01 22:45:25 -0700 |
commit | 48f48240e3d980785b146584dd81a390d3e1af47 (patch) | |
tree | aaac4ffb99210a121e6390527689be18afa55baf | |
parent | b7bf00c5dc033406fd00d95e6a9dd8e663be3a4e (diff) | |
download | dotfiles-48f48240e3d980785b146584dd81a390d3e1af47.tar.gz |
mpd-cover-convert
-rw-r--r-- | .zshrc-linux-desktop | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/.zshrc-linux-desktop b/.zshrc-linux-desktop index f92845b..e744785 100644 --- a/.zshrc-linux-desktop +++ b/.zshrc-linux-desktop @@ -15,6 +15,16 @@ mpd-sleep() { done } +mpd-cover-convert() { + find ~/music -type f -regextype posix-extended -regex ".*cover\.(png|jpg)"\ + | while read file; do + d=$(dirname "$file") + if [[ ! -f "$d/cover-small.png" ]]; then + convert "$file" -resize 250x "$d/cover-small.png" + fi + done +} + # list stats about mpd library file types, to motivate me # to do better! mpd-filetypes() { @@ -23,7 +33,8 @@ mpd-filetypes() { # hackily yoink recognised types from mpd --version types=(); mpd --version \ | sed -n '1h; 1!H; ${g; s/.*Decoders plugins:\(.*\)Output.*/\1/g; p}'\ - | tr -s ' ' '\n' | sed -e 's/.*\]//' -e '/^$/d' | sort | uniq | while read word; do + | tr -s ' ' '\n' | sed -e 's/.*\]//' -e '/^$/d' | sort | uniq\ + | while read word; do types[$(( ${#types} + 1 ))]="$word" done types[$(( ${#types} + 1 ))]="other" |