Sunday, July 28, 2013

Real-time meta data from Icecast using LiquidSoap (reprise)

I found a bug in my script. It pops up when there's an apostrophe or a paren in the song title. Below, I've modified the script slightly to fix this issue. Also, I've changed the external program call so that it uses notify-send to pop up the song title on my desktop.







set("log.file",false)
set("log.stdout",false)
set("log.level",3)
def apply_metadata(m) =
title = m["title"]
#print("Now playing: #{title}")
system("notify-send #{quote(title)}")
endradio = input.http(
user_agent="joats/kludged-up-script",
timeout=30.,
poll_delay=.5,
new_track_on_metadata=true,
force_mime="audio/mpeg",
buffer=.5,
id="original",
"http://music.joat:8000/airtime_128"
)

radio = on_metadata(apply_metadata,radio)
output.dummy(fallible=true,radio)

For those that can't see it, the changes are all in the line starting with "system".

No comments:

Post a Comment