Use metadata from input.harbor to populate now-playing in output.icecast

Since we moved servers for clouwdnine.com, I had some troubles with getting the “Now Playing” text right. Before, this was always populated with the Description or Name our DJs would enter in BUTT. This allowed us to inform visitors of the website to see who was playing, which we liked…

Sadly, I couldn’t find how to fix this, but after way too much time I managed to do this. Just storing it here for people who would like this.


meta = ref []

def update_title(m) =
  me = !meta
# log(json_of(m))
# log(json_of(me))
  if me["title"] != "" then
    title = me["title"]
    [("title","#{title} - LIVE")]
  else
    title = m["title"]
    [("title","#{title} - archive")]
  end
end

def djdisconnects() =
  meta := []
end

def djconnects(h) =
#  log(json_of(h))
  meta := [("title",h["ice-description"])]
end

live = input.harbor("/",port=8000,password="XXXX",icy=true,on_connect=djconnects, on_disconnect=djdisconnects)

radio = map_metadata(update_title,radio)

Leave a Reply

Your email address will not be published. Required fields are marked *