Heres something new and something old all rolled into one!
I have been dropping hints about the possibility of a scriptable service for a while. I even showed off a very crude prototype in a lightning talk at aKademy last year. Since then, architectural changes to Amarok and task that were more important ( and a lot simple ) pushed this work to the bottom of my long term TODO list. It newer quite left my mind though. I think that the potential benefits of allowing people to quickly and easily integrate their own content into Amarok, without having to mess around with building the entire app are huge. It will allow people to add and distribute services for content that, while interesting, does not have a broad enough appeal to warrant inclusion in the Amarok core, and it will allow people to integrate content and services that we simply have not thought about.
So, when sitting in a small cabin in the woods, with no internet and plenty of time on my hands, because my Girlfriend is busy studying for an exam, it did not really take long to decide what I really wanted to work on.
And now I am back... So, without further delay, I give you the new, improved, and actually working scriptable service framework!
I decided to completely rethink both the DBus API and the way Scriptable services interacted with the rest of Amarok. The entire API now consists of 3 DBus functions and 2 callback commands that the script must respond to. Also, everything is completely dynamic, meaning that the service will not use the script to populate any items before they are needed.
Here is a few screenshots of a scripted service in action.
First of all, the scriptable service framework now integrates in a simmilar way to all other Amarok scripts, making it possible to start, stop and manage them from the "Script Manager" dialog:
When running, it ill appear in the service browser along with any other loaded services:
And when activated, it will appear just like any other service, complete with optional html info for each item ( supplied by the script of course ):
The "Cool Streams" script is my first attempt at a usable script. It basically just implements the list of cool streams from Amarok 1.4 as a service. The entire script is about 80 lines of ruby code, and half of this is taken up by the array of stations to add. About half of the remaining code is comments. So setting up a simple new service really does not take much code, and as there are only 3 DBus functions needed, it is really quite simple do do.
So, despite what I have been telling people lately, Amarok 2.0 will ship with the possibility of adding new services using scripts. I am really exited about this feature, as the general scripting support in Amarok has yielded and incredible amount of interesting features that none of the regular developers had ever though of. In the same way, I hope that the scriptable service support will inspire people to add interesting new content to Amarok.