GNOME Bugzilla – Bug 579754
Add item rating to DBus interface
Last modified: 2011-08-22 06:50:31 UTC
Banshee's DBus interface provides various controls (playback, volume, ...) and information retrieval (song meta data). However, I really miss the possibility to rate items by the DBus interface. I've written a patch that adds rating of an item as a writable property to the IPlayerEngineService. I'm not sure if this is the right place for that - it simply seemed most obvious to me. With the given patch, rating now can be read and changed with DBus as follows: org.bansheeproject.Banshee.PlayerEngine.GetRating() org.bansheeproject.Banshee.PlayerEngine.SetRating(int) I've tested this with file based items - works :) But it does not work with radio stations :( their rating seems to be saved differently than file based items. The patch is against the source tarball 1.4.3, because the current trunk version (rev. 5209) failed to build on my system. This is my first Banshee patch - no idea if my approach is the right one, comments and improvements are welcome. Regards, Oben
Created attachment 133060 [details] [review] patch to add item rating to the player engine dbus interface
Would be happy about some feedback. If the patch is not suitable to be integrated in the Banshee code, I would be glad to improve it .. just need a kind of response/mentoring :)
*** Bug 560238 has been marked as a duplicate of this bug. ***
Hrm, it doesn't seem idea to have this in the PlayerEngineService, though it is the easiest way to add it atm, since we don't export actual Track objects we could have the method/property on. Aaron, Alexander, Bertrand: thoughts?
I'm not that much familiar with D-Bus and its best practices, however placing the Rating property to the PlayerEngine object seems a bit awkward to me. We should probably expose the currently playing track as a separate object containing all the usual track properties including the rating.
Any further thoughts on this? As a user I would prefer if it works rather than the semantics of how it works.
I agree with mstrelan, a not perfect but working solution is better than nothing. Additionally I think it is not that awkward to have a rating property in the PlayerEngine: "Rate what's currently played" is IMHO a more common use case than "Rate a specific track from the library".
I see 2 use cases: 1) Rate what is playing now 2) Exchange playlist/track info between media players #1 is pretty self explanatory. #2 would be used in case where a one wishes to transfer his/her music library from/to Banshee to/from X. As a user, I'd like both.
The attached patch matches use case #1. For use case #2, the CollectionIndexer DBus interface seems to be the right place, but AFAIK track meta data is read-only here too. @banshee-developers: Given the last posts, any new thoughts on including the patch as a quick-fix to adjust rating via DBus?
I committed a slightly modified version of the patch, thanks Oben!
I also added --set-rating=RATING command line option. You will need dbus-sharp installed from source to use it though, see bug 541279.
Great, thank you!
I'm sorry that I have to push this bug, but I'm afraid that the --set-rating=RATING command line option is not documented in the manpage. I wanted to add it in the current git head, but I didn't find the manpage definition. It would be very helpful, if this command line option would be documented in the manpage.