I’m at home. And battling to cover costs of moving home, finishing renovations (garden), and playing breadwinner for wife and child. Despite working, finances weren’t there in time for me to attend the always fabulous Linux.conf.au in Brisbane this year, much to my disappointment, so I stayed home and, around work, watching the video streams.
Let’s start with a big thank you to the guys and girls who worked the A/V kit; ensured audio was there, video was focused and framed, slides were pulled in, and streams happened.
Which got me to thinking; how many people are watching? All very nice to know after the show, but what about real time, so that the director, team and even presenter knows where there audience is. Each icecast server does show this information when the server’s admin logs in. Neat.
However, to distibute content, you need a lot of severs to distribute the streams, and quite probably, these servers are being run by Other People, who probably don’t want to give you their admin password to log into their icecast server.
We need a way of having something take the values from the admin interface, and expose that so we can collect these statistics.
Thus I scribbled down two scripts: one a CGI script to fetch the data from the local icecast server and serve it as a CGI in JSON format, and a second to collect multiple instacnes of this CGI’s output in parallel.
The first script would be run by the same admin who runs the remote icecast server, as the script needs to have the icecast admin password. It uses XPath expressions to fetch relevent pieces of information, and return it as JSON, a pretty compact format.
The second currently just fetches this data and displays, it, but with a little more hacking it could pump these results into an RRD, thereby giving us the option of graphing the results.
It’s very much a poll, and probably something to repeat every 15, 30 or 60 seconds. It would need to dynamically handle the adding (and removing) of individual icecast servers as they are brought online. But it’s a start.
Code can be found in my pseronal SVN repo.
Brought to you by the Perl modules CGI, JSON, HTML::Treebuilder::XPath, WWW::Curl::Multi, and others.
While I’m here, I think next year we should arrange to have an Icecast server in each city of Australia. If I had to pick one issue, I was having to connect to the US or European relays when the one public one at UQ was full or “having a moment”. I’d urge each LUG around the country to, if they have a server on decent bandwidth, offer to relay the streams; if not publicly, then at least to their members.