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)

CLWD009

Together with some guys from /r/realdubstep we started a new radio station. It’s a very community driven radio station, but with DJs pushing the sound nonetheless.

Anyways, I did my best to face all the technical challenges that go around in creating a radio station and website for this, and in the coming weeks we will be going live with the latest website. I plan on writing a description of the steps that I took for creating what I did, for documentation sake and in hopes of spreading some of the information for people that face similar challenges.

In short, the entire radio system runs on a VPS hosted at Icecast for the radio backend.

  • WordPress for the website.
  • jplayer for the onsite radio player.
  • qwebirc for the onsite chatroom.
  • And some self-coded PHP and Python for chatbots and twitter bots and stats all.
    • In addition the analytics part of the website is quite advanced, providing us insight in how well the DJ’s on the website are doing (how many listeners the DJ’s attract, how long the listeners stay).

      I will chop up the entire system in two or three parts and describe them along the following weeks.

    Newcastle

    So I’ve been to Newcastle with the Mrs and it’s been fun. Took my 35mm as walkaround lens and shot away. I did learn how to level my horizons, which is nice. I do still need to learn how not to abuse my f1.8 and to limit ISO to 800, because 1600 is kind of … meh…

    Nikkor AF-S 35mm f1.8

    I finally bought the lens I’ve been longing for so long… First pictures I took with it, let’s hope it’ll only improve from here.