commit 35309025a4620adbb7a1839d79e881cd70e3d8ec parent 5c6b9459b4a247fdd24cf7eb6a71211d56b1a83c Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Wed, 29 Jan 2020 19:06:51 +0100 Add scripts for finding and playing newest albums Diffstat:
A | .local/bin/mpc-newest.sh | | | 4 | ++++ |
A | .local/bin/mpc-play-newest.sh | | | 14 | ++++++++++++++ |
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/.local/bin/mpc-newest.sh b/.local/bin/mpc-newest.sh @@ -0,0 +1,4 @@ +#!/bin/sh +[ $# -gt 0 ] && n="$1" || n=20 + +grep 'added' /var/log/mpd/mpd.log | sed 's/.*added //;s/\// - /;s/\/.*//' | uniq | tail -n "$n" diff --git a/.local/bin/mpc-play-newest.sh b/.local/bin/mpc-play-newest.sh @@ -0,0 +1,14 @@ +#!/bin/sh +mpc clear >/dev/null + +[ $# -gt 0 ] && n="$1" || n=20 + +albums="$(mpc-newest.sh "$n" | sed 's/.* - //')" + +while read -r a; do + mpc search album "$a" | mpc insert +done <<EOF +$albums +EOF + +mpc play >/dev/null