commit 9ce3fae4a48d4e217c7f54dd138a9571b454dc6c parent 4bd674a234565d701e9362dc59cbac02c93cdf4f Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Wed, 7 Oct 2020 10:15:05 +0200 mpc-random-album.sh: add option to select host with cmd line argument Diffstat:
M | .local/bin/mpc-random-album.sh | | | 18 | ++++++++++++------ |
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/.local/bin/mpc-random-album.sh b/.local/bin/mpc-random-album.sh @@ -1,7 +1,13 @@ -#!/bin/sh -e -a="$(mpc list album | sort -R | head -1)" -mpc clear >/dev/null -mpc findadd album "$a" +#!/bin/sh +set -e +if [ $# -gt 0 ]; then + host="$1" +else + host="localhost" +fi +a="$(mpc --host "$host" list album | sort -R | head -1)" +mpc --host "$host" clear >/dev/null +mpc --host "$host" findadd album "$a" printf '# %s\n' "$a" -mpc playlist -mpc play >/dev/null +mpc --host "$host" playlist +mpc --host "$host" play >/dev/null