I recently had to reinstall Raspbmc for the 4th time in as many days, thanks to an automatic update, sunspot activity, and possibly an intermittently dodgy SD card.

Latest attempt seems to be working (touch wood); the Pi hasn’t bricked itself yet, and the networking is still working. However, fan art is not being downloaded.

This is a note to self, but might be of use to those of you in a similar situation.

The Problem

You’re running XBMC/Raspbmc on a box in your home network. This network sits behind a combined Squid + Privoxy proxy, to provide network level object caching and malware/advert filtering.

You update your library, and while TV season descriptions are loaded, season images and fan art are not.

The Solution

What seems to be happening is that Privoxy is incorrectly identifying fan art images as adverts, which is causing Privoxy to return a 403 error when XBMC attempts to retrieve the resource. This only seems to be happening with the thetvdb scraper, the IMDB scraper for movies seems to have no issue.

The fix is simple, all you need to do is add an exception for thetvdb.com in your /etc/privoxy/user.actions file:

{ allow-ads }
.thetvdb.com

Now you should find that season fan art is accessible once more!

Just a quick post to bring you an update on the email posting support for Idno.

The email posting plugin is a handy plugin that allows you to make posts to your Idno site via email. Unfortunately, since the way POSSE syndication buttons worked was changed a little while ago, it hasn’t been possible to post out to your silo followers in twitter/facebook/etc.

No longer! Now, you are able to specify a syndication destination by putting one or more pipe tags in the email subject line (these will be removed from the post). So, for example to post to twitter, you’d use the “|” (pipe) character before the service, and add a |twitter to the subject line.

Have fun!

» Visit the project on Github...

Following from a similar post, where I packaged up my standard web services libraries to avoid repeating myself, I decided to do the same for Events and triggers.

Events provide a very powerful, flexible and simple way of providing hooks for other code to attach to, in a loosely coupled way. I’ve been using event driven development in my PHP code for years, way back since the first days of Elgg. In Elgg, events and triggers proved to be one of the frameworks most powerful, and a major factor in its success, allowing plugin developers to easily change core functionality without changing a line of core code.

Anyway, I’ve used Events in one form or another in pretty much every framework since, and I’ve found myself increasingly cutting and pasting code around, so I figured it’d be sensible to package this up into a reusable library as well. Although it is designed to be simple, the library is pretty powerful.

One particularly useful feature is that event listeners can include regexp!

Triggering an event…

If you were writing a framework that had users for example, and you wanted to allow plugin authors to hook in and do something when a new user is created, you might do something like this in your registration code…

function registerUser($username, $password) {

    ...
    // User creation code here
    ...

    // Ok, now tell everyone that a user has been created
    \simple_event_dispatcher\Events::trigger('user', 'create', ['user' => $new_user]);

}

Listening to an event…

So, if you wanted to listen to the user creation event inside your plugin…

// Register an event for every time a user is created
\simple_event_dispatcher\Events::register('user', 'create', function($namespace, $event, &$parameters) { 

    // Your code here

});

You can replace any part of the $namespace or $event string in Events::register (‘user‘ and ‘create‘ respectively in the example above) with regular expression. So, you could, for example, replace ‘user‘ with ‘*‘ to listen with any create event.

Code on GitHub, have fun!

» Visit the project on Github...