I threw together some code for querying and parsing the BBC iPlayer search pages and emailing the results to you. You configure it by putting the names of the programmes you want to look out for into config.yaml, along with your email details, e.g.
search_terms: - mighty boosh - lead balloon - never better email: email_to: email@example.com email_from: email@example.com server: mail.example.com user: email@example.com pass: password auth_type: login
Copy the sample config.yaml.dist to config.yaml in the same directory and edit.
I run the command line script via cron once a day by calling the cli.rb script with an --email switch, e.g. with the following line in crontab:
0 21 * * * /usr/bin/ruby /home/ell/dev/iplayer/cli.rb --email
You could as easily run it from a Windows scheduled task.
Dependencies are:
What it does is request the iPlayer search page with each search term, one after the other. If there are multiple pages of results, it fetches each of those too, aggregating the results. It will then email you a list of links to the programmes on the iPlayer site. One thing it does which the iPlayer search page doesn't do is sort the matching results by how long is left for you to watch them: the ones with the least amount of time left are at the top.
You can also run it as a local web server on port 3334 with:
ruby server.rb
Which then becomes accessible at:
http://localhost:3334/
Nothing fancy: just an HTML page with the search results in it, using the same config. as the command-line client. You can also call the page with extra search parameters to perform custom one-off searches, e.g.
http://localhost:3334/?search=doctor+who
It's not a serious project, just a convenience for me. GPL licence.
Another update: I noticed today that this module had disabled my site. I'm not sure why, but I think it may be because Last.fm wasn't responding. I'm still using it, but if you have it on your site and everything goes bad, it might be because Last.fm isn't available. I manually disabled it in the system table for my Drupal install and my site came back to life, so I know it was this module that caused the problem. I need to do some more debugging before it's suitable for production, so use at your own risk, or exclude the block from the admin page so at least you can disable the module if it causes problems.
Update: I've just updated this slightly, so that the cached track listing is used if your recent tracks from Last.fm is blank. This avoids you getting an empty listing if you haven't been listening to music for a while. I also updated it a second time to prevent errors occurring if you get broken XML back from Last.fm (which happened to me once, and caused my whole site to crash).
I've had a couple of requests for my Last.fm Drupal module, in response to a previous blog post. This was also a good opportunity to learn how to write modules for Drupal 5 and learn the new forms API, which I've now done.
The new version is attached to the bottom of this post. It requires Drupal 5 and PHP 5 with the DOM extension enabled (this is used for parsing the XML feed from Last.fm). It won't check whether the DOM extension is enabled (it's not that clever yet), so it could cause issues (like your site breaking) if you try to install it on a system without PHP 5 and/or the DOM extension.
Install it as a standard module (drop into the modules directory, enable in Administer > Site building > Modules). I've integrated it with the admin. system (under Administer > Site configuration > Last.fm module settings), so you'll need to configure it there before it works. The settings required are:
Then turn on the block with the title Recent tracks in the block admin. pages. And away you go! As proof it actually works, see the left-hand side of this site, where it's in action.
My code for exporting Mozilla/Firefox bookmarks to del.icio.us is now hosted on SourceForge at http://sourceforge.net/projects/bkmrk2dlcs/.
This is a relatively simple Python script for managing a mass of .ogg and .mp3 files. I developed it using Python 2.4.2, on Ubuntu "Breezy". You will need the python-pyvorbis, python-id3 and python2.4-id3lib packages (that's what they're called on Ubuntu, anyway; the Python libraries you need are ID3 and ogg.vorbis).
Features:
For usage instructions, run:
python music_manager.py --help
The script is released under the GNU Public License (GPL). See below for a copy of this license.
Attachments: