22 lines
697 B
Bash
Executable file
22 lines
697 B
Bash
Executable file
|
|
read -d'\n' -ra PLAYERS <<<"$(playerctl -l 2>/dev/null)"
|
|
declare -a PAUSED
|
|
for player in "${PLAYERS[@]}"; do
|
|
[ "$player" = "playerctld" ] && continue;
|
|
|
|
p_status=$(playerctl -p "$player" status 2>/dev/null)
|
|
|
|
# if we have one playing, we'll use it and EXIT
|
|
if [ "$p_status" = "Playing" ]; then
|
|
echo $(playerctl -p $player metadata | grep artUrl | awk '{$1=$2=""; print $0}')
|
|
exit 0;
|
|
fi
|
|
|
|
[ "$p_status" = "Paused" ] && PAUSED+=("$player")
|
|
done
|
|
|
|
# if we have a paused, show it otherwise assume there are no players or have all stopped
|
|
if [ -n "${PAUSED[0]}" ]; then
|
|
echo $(playerctl -p ${PAUSED[0]} metadata | grep artUrl | awk '{$1=$2=""; print $0}')
|
|
fi
|
|
|