Anybody … A little help needed with tint2 pyradio-panel-info.sh
I made a little script that shows the Artist and title of Pyradio in tint2. It works.
Only if there is a …
&
… character in the Title, there is no output.
How can I adjust the & issue.
#!/bin/sh
readonly STR="$(awk '// { save=$0 }END{ print save }' ~/.config/pyradio/pyradio-titles.log)"
function PID_ON {
pidof -x pyradio
}
# Show Pyradio title in tint2
if PID_ON
then
echo "${STR:21:100}"
fi
if ! PID_ON
then
echo ""
fi
Now that Pyradio server is working stable , I modified the script of Pyradio panel title.
It checks Playback/Idle status through the server.
Operation :
Server ON : Title is displayed at PLAYBACK. Title disappears in PAUSE mode.
Server OFF : Title is always displayed.
Remark :
It can happen that the title does not appear, but everything is ok, then there is a & in the title somewhere in the way to display the text.
Check ~/.config/pyradio/pyradio-titles.log to see the & in the title.
It’s already a lot less with @napcok’s adjustments.
#!/bin/bash
shopt -s extglob
pyradio_status="$(curl http://127.0.0.1:9998/html/info | grep 'Status' | grep playback | wc -l)"
if test $pyradio_status -gt 0
then
TITLE=$(tail -n 1 ~/.config/pyradio/pyradio-titles.log|cut -d'|' -f2)
TITLE=${TITLE##*( )} # remove leading spaces
echo "${TITLE/&/&}" # replace
else
echo ""
fi