WCYG Gets a Block
I added a WCYG block to the site last night. It includes the URL to the WCYG stream, the currently playing song, and, once I fix it tonight, a list of recently played songs. Read on to find out how I did it.
I'd been thinking about publishing real-time WCYG info on the site for a few days, and I was looking for a Winamp plugin that would create a text file with current song information as a new song in the playlist was started. I looked for references using Google, and was pointed to a few plugins on the Winamp site. They either weren't appropriate or didn't work. Then I remembered the various tools that Oddsock had published on his site in addition to the Oddcast and Icecast2 Win32 products I'm currently using. He has a Winamp plugin called "Do Something" that can be programmed to do a number of actions on each song change.
I saw almost immediately that Do Something's "Generate HTML Playlist" function was what I wanted. You point Do Something to an HTML template that includes your desired formatting and some predefined variables, which are loaded with values from the playlist or ID3 tag info. Then you give it an HTML output file pathname. Every time a song change occurs, Do Something will read in the template, substitute in the current variable values, and output the desired HTML file. Once I set this up with appropriate filenames and locations, within ten minutes I was tweaking the format of the output. It was too easy.
I then pointed Zope (the web application server that runs this site) to the output HTML file and it is used as the contents for the block. The beauty of this is that Do Something doesn't need to talk to Zope at all for this to work seemlessly. I'm going to send my thanks to Oddsock for making such a useful (and well documented) tool!