commit 84ae234c3f9e211979d8bcb19407deed799d5036 parent 97088ad1c79b672f7e23dfc00fedc0f072e539e6 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Thu, 12 Nov 2020 14:20:45 +0100 mpc-random-album.sh: only show mpc output if ncmpc isn't running Diffstat:
M | .local/bin/mpc-random-album.sh | | | 14 | ++++++++------ |
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/.local/bin/mpc-random-album.sh b/.local/bin/mpc-random-album.sh @@ -5,9 +5,11 @@ if [ $# -gt 0 ]; then 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 --host "$host" playlist -mpc --host "$host" play >/dev/null +a="$(mpc -q --host "$host" list album | sort -R | head -1)" +mpc -q --host "$host" clear +mpc -q --host "$host" findadd album "$a" +if ! pgrep ncmpc >/dev/null 2>&1; then + printf '# %s\n' "$a" + mpc -q --host "$host" playlist +fi +mpc -q --host "$host" play