[Rhythmbox-devel] Extending the audioscrobbler plugin, dealing with online radio stations



Hi,

I am planning to make some changes in the audioscrobbling plugin, because it does not submit all the song titles. Specifically, it is "immune" to songs played via online radio streams, such as this one: http://wknc.sma.ncsu.edu:8000/wknchq.ogg.m3u


The reason that happens is because [from what I understand], the plugin is subscribed to the playingUriChanged signal. During the playback of the radio stream, the URI is constant, hence the plugin does not "see" the change.

The signal that does notify about a changed song in the case of such radio streams, is playingSongPropertyChanged. The last 2 arguments will contain the desired information. Here is a minimal Python example that shows how that works: http://pastebin.com/ZBF8UfrQ

My options are:
1. modify the existing plugin
2. create a new plugin that waits for playingSongPropertyChanged, extracts the metadata, then passes that metadata to the actual audioscrobbler plugin and lets it do the talking to last.fm's servers


#1 sounds like the most sane solution.
#2 may be easier, if the additional plugin is written in Python [but the easy way is not necessarily the best one]

After examining the code in rb-audioscrobbler.c, I figured I'd have to:
- subscribe to playingSongPropertyChanged signals
- when the signal is received, call rb_audioscrobbler_song_changed_cb, passing info about the song



There are some things that make streaming radio stations somewhat different from regular songs, ex:
- there is no such thing as "song length", it is a continuous stream; a workaround would be to queue the song for scrobbling as soon as the title changes
- sometimes radio stations feed us with undesired data in the strings (name of the station, phone number to call if you want to get on air, etc); so these strings will have to be processed before submission to last.fm. The good news is that last.fm apply some corrections themselves, I hope they will do the dirty job of cleaning up the mess in the strings


Can someone tell me whether this is the right course of action? Perhaps I do not understand the model correctly, or maybe there are some pitfalls I should be aware of?

Alex


p.s. I've never written any software that uses GTK, DBus, GObject et al - so if what I wrote sounds silly or mixed up the terminology, it is my fault :-)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]