#!/bin/sh get_pctl_status () { player="$(check_for_mpd)" if [ "$player" = "" ]; then playerctl_status=$(playerctl status 2>/dev/null) else playerctl_status=$(playerctl -p "$player" status 2>/dev/null) fi exit_code=$? if [ $exit_code -eq 0 ]; then echo "$playerctl_status" else echo "NPF" fi } check_for_mpd () { pctl_players="$(playerctl -l)" while IFS= read line; do line="$(echo $line | sed -e 's/\ //')" if [ "$line" = "mpd" ]; then echo "$line" fi done <$artist>$album>$title" fi else if [ "$status" = "Playing" ] || [ "$status" = "Paused" ]; then artist="$(playerctl metadata artist)" album="$(playerctl metadata album)" title="$(playerctl metadata title)" if [ "$album" = "" ]; then echo "no>$artist>$title" else echo "yes>$artist>$album>$title" fi fi fi } case $1 in status) get_pctl_status ;; text) get_display_text ;; get-metadata) get_metadata ;; esac