Pilot of the airwaves, here is my request. You don't have to help me, but I hope you'll do your best.
June 18, 2007 12:20 PM   Subscribe

Who here is willing to help a PHP noob with what should be a simple task?

We want to build a semi-live playlist for our radio station, showing what songs are played hour-by-hour. The idea of typing each song in totally sucks, especially when sites like Yes.com are already monitoring the on-air stream and "fingerprinting" the songs.

We would just use the Yes.com feed, but there are two major problems with it: (1) It's riddled with affiliate links, and (2) we play lots of local music, which it does not recognize. So we need to be able to type in the 3-5 songs an hour it skips.

If you've got the kindness and the inclination, have a look at this:


To see, for instance, what I played in the 7 o'clock hour this morning. What we'd love to have is a PHP script that, once an hour, snags this page (with the hour= parameter adjusted for the hour that just ended - so, at 8:05 or thereabouts, it would grab the 7 o'clock hour), pull out just the pertinent info (artist, song title, time played), and write it to an editable format.

That editable format? Could be as simple as a text file, one for each hour. More ideally, I'd love it if it could write the results to a Wordpress entry, one blog post per hour, since WP inherently tracks the date of the post, and that would make it reaaallly easy to (a) add a clickable calendar to the site and (b) let jocks go back in and add the cuts that were skipped.

Am I kidding myself that this is a fairly simple task for PHP, if only one knows how to do it? (We're non-commercial radio, BTW, with a technical staff of 0, hence me posting here.)
posted by jbickers to Computers & Internet (6 answers total) 1 user marked this as a favorite
If the radio station has an RSS feed of their playlist, you can easily parse (pull apart) the RSS feed to get the bits of information that you want using the functions in the free Magpie RSS add-on for PHP.
posted by Blazecock Pileon at 12:36 PM on June 18, 2007

If they don't have an RSS feed, and that page you link to is "well-formed", you may be able to parse the HTML file using PHP's DOM functions.
posted by Blazecock Pileon at 12:38 PM on June 18, 2007

While you could, indeed, parse the YES page and reformat it, I'm willing to bet this is an instant violation of their terms of use. (Personally, I always wondered why stations put up with YES using their data for a branding-a-thon.)

I take it you aren't using an automation setup? These often have some exportable data that can be used for this kind of thing.

Short of that, yeah, you're typing it all in, but consider for a moment that manual entry and automation-parsing are about the only methods you can use to get properly-formatted data if you want to use this output for royalty reporting later on.

(p.s. drop me an email if you like. Been steeped in this topic for a while.)
posted by bhance at 12:52 PM on June 18, 2007

Blazecock Pileon: The poster is the radio station, and is trying to create the playlist.
posted by Artifice_Eternity at 7:29 PM on June 18, 2007

I've got some time to just mess around so I made this up real quick... not really tested so forgive me for any sloppyness etc...


bhance is right though... it is definitely worth investigating yes.com's terms of service... although since it sounds like it's your content they are in a sense republishing I really wonder whether you may be in a different situation

It's written in Perl, not PHP... I'm not that familiar with the WordPress API, but found a Perl Module for automating posts in a quick Google search...

Maybe it can at least give you some ideas...

Based on the source from the link you gave the title tracks are always between "dt" tags

Found the WordPress module here...
posted by vitrum at 2:40 PM on June 20, 2007

Actually use this, just realized that other nopaste site deletes in 24 hours...
posted by vitrum at 2:58 PM on June 20, 2007

« Older How dangerous is a bumpy ride to work for my...   |   How do I make an eBay lesson plan? Newer »
This thread is closed to new comments.