Sadly Rhythmnbox doesn't scrobble radio stations (even though the scrobble API has a flag for this
track.scrobble(chosenByUser=0) to indicate that its been chosen by a radio service), despite it updating my 'now listening' status on IM. So, in a geeky overkill solution I decided to save time in the long run and use a pub/sub system with MQTT. Oh, and use some python and twitter along the way...
The design is that I have an MQTT publisher that uses the tritter streaming api (via tweepy) and filters for all the somafm twitter streams that Rusty pushes with BigUrl. This gives me near realtime announcements of the start of the track being played (after some trivial split / strip manipulation)
ie
justcovers Pat Boone - Enter Sandman (2012-06-25 07:20:30)
digitalis Zephyrs - Stand Round Hold Hands (Ulrich (2012-06-25 07:20:37)
secretagentsoma Eat Static - Love Truncheon (2012-06-25 07:21:02)
beatblender Kerry Chandler (Lazy Dog Ben W - Isis (2012-06-25 07:21:29)
sonicuniverse In The Country - Only The Birds Can See Us (2012-06-25 07:21:29)
..which I can then publish to an internal MQTT broker using mosquitto python bindings.
In a separate process I have a subscriber that I can point to the broker and 'subscribe' to the radio station when I'm listening and it scrobbles that information to last.fm.
All in, an interesting sunday evening work.
No comments:
Post a Comment