2020-07-04 14:23:27 +02:00
|
|
|
#!/bin/sh
|
2021-05-09 18:18:57 +02:00
|
|
|
if mpc status | grep -q '\[paused\]' || [ "$(mpc status | wc -l)" -eq 1 ]; then
|
2020-08-29 16:54:11 +02:00
|
|
|
printf '\n'
|
2020-07-04 14:23:27 +02:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $( mpc status | grep '\[playing\]' | wc -l ) -eq 1 ]; then
|
2021-03-10 15:31:40 +01:00
|
|
|
full_length="$(mpc status | sed "/^volume:/d" | tac | sed -e "s/\\[paused\\].*//g;s/\\[playing\\].*//g" | tr -d '\n' | sed -e "s/$/ /g")"
|
|
|
|
#remove full directory structure if no title present and too long
|
|
|
|
if [ ${#full_length} -gt 40 ]; then
|
|
|
|
echo "${full_length##*/}"
|
|
|
|
else
|
|
|
|
echo "$full_length"
|
|
|
|
fi
|
2020-07-04 14:23:27 +02:00
|
|
|
exit
|
|
|
|
fi
|