Amarok currently playing status via Psi now almost XEP-0118 compliant
Now that in its 2.0 incarnation Ejabberd supports publish-subscribe and therefore personal eventing, it is time to play with it and demonstrate to the wider world the marvellous use-cases that the future holds. A nice first one that should be popular and therefore useful for propaganda purposes is using Psi so that contacts can see in your presence status the music that you are playing. I stumbled upon an Amarok script that notifies Psi’s through the tune file interface and lets Psi publish the currently playing song status via PEP – and it looked good.
PEP is defined “XEP-0163: Personal Eventing via Pubsub“. And Pubsub is defined by “XEP-0060: Publish-Subscribe“. So far so good. But digging around a bit I learned about “XEP-0118: User Tune” and then it dawned on me that there appeared to be room for improvement : the script outputs a composite “tune” element which is a radical simplification of the schema specified in XEP-0118.
So I had a go at modifying the script to get it as close to the specification as possible. You can judge of the resulting output for yourself : not quite XEP-0118 compliant but a good step in that direction.
The source code is available from the usual dump, but if you are an Amarok and Psi user you might actually want to use the Amarok script package that installs and runs in a coupe of clicks – thanks to the previous authors whose work I built upon.
While I was at it I discovered a bug that causes Psi 0.11 to use the element tag “source” to contain the album information, so I promptly provided the psi project team with the trivial patch needed.
It is is 3:30 AM and a few hours ago I did not realize that upgrading Ejabberd would get me that far for today…
6 responses to “Amarok currently playing status via Psi now almost XEP-0118 compliant”
Leave a Reply
You must be logged in to post a comment.
About that Psi bug: there is no tag; albums are always specified in the tag according to XEP-0118.
And about the comment of Psi not being XEP-0118 conformant because it ‘ignores ratings’: as a client, you are free to send and display whatever information you want, so claiming it’s non-conformant is a bit harsh ;-)
Forgot to mention that ‘rating’ is something that was added only 3 months ago to the protocol, while Psi’s tune implementation is almost 2 years old. It just needs to be updated, which I plan to do in 0.13.
All my apologies to Remko Tronçon and the other Psi developers : I acted stupidly by posting at three AM half asleep. In my hazy tired mind I did a nice piece of wishful reading of the specification – “Album” sounded better than “Source”… Sorry !
I was not aware of the age of Psi’s tune implementation : of course two years is a long time for that sort of things. And I did not mean to be harsh by stating non-conformance – and the specification does not mention the rating element as a mandatory one anyway.
Anyway, yay for the 0.13 update and thanks for posting !
I’m using the amarok package, and it works nicely, however I still see Psi seems to cut off the rest of the information after artist and title…not sure why that is.
Anyway, great work, and glad to see someone else is working on this too!
Ah, so after digging around for a while, I found where the artist and title get parsed, and created a patch to add in the album as well (length and track number seem a little verbose for the tooltip) and am waiting for confirmation to post a bugfix to Psi.