You are not logged in.
a few days ago this was working fine but now it will print the song name on the screen and doesn't go away like its supposed to(specified by the ``-d" option for osd_cat). anyone see something wrong? and wth did it work fine a few days ago? also, any general programming tips would be appreciated as this is really the most complicated script i've ever had to write.
#!/usr/bin/env bash
#Options:
SCRIPT_DELAY=5
COLOR=black
POSITION=bottom
OFFSET=-50
MPD_HOST=127.0.0.1
OSD_DURATION=5
#extract just the artist/track name from mpc output
function songname() { mpc | sed '2,3d' ; }
#check if song has changed and break if no. if yes, update MPDSONG and print it on screen
function printsong() {
#if mpc's output is only 1 line, then mpc is stopped, so don't print anything
if [ `mpc | wc -l` == 1 ]
then return 1
else
while [ 1 ]
do
MPDSONG2=`songname`
if [ "${MPDSONG}" == "${MPDSONG2}" ]
then
break
else
MPDSONG=`songname`
echo $MPDSONG | osd_cat -d "${OSD_DURATION}" -p bottom -c black -u red -O 2 -i 6 --offset="${OFFSET}"
--font=-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*
fi
done
fi
}
while [ 1 ]
do
MPDSONG=`songname`
sleep $SCRIPT_DELAY
printsong
done
Last edited by _adam_ (2007-10-01 17:08:51)
Offline
It is working or me. Though I removed to --font argument from the osd_cat command because I don't have the font installed.
The second infinite loop in the function printsong seems a little useless to me.
Hail to the thief!
Offline
thanks. i see what you're saying about that loop and feel kinda dumb i didn't catch that lol.
does it go away after 5 seconds?
Offline