GNOME Bugzilla – Bug 623183
Song rating isn't available outside the UI until restart
Last modified: 2011-03-19 18:23:44 UTC
Created attachment 164939 [details] Screenshot of the UI showing the song's rating When rating a song, the rating isn't available outside of the UI until the player is restarted, even though "Write ratings and play counts to files" and "Write metadata to files" are both ticket. This is reproducible on both the DBus interface via Python-DBus, and via the commandline, using banshee --query-rating. Python-DBus Reproducing Code: >>> from dbus import SessionBus >>> SessionBus ().get_object ("org.bansheeproject.Banshee", "/org/bansheeproject/Banshee/PlayerEngine").GetCurrentTrack ()['name'] dbus.String(u'Crocodile Rock', variant_level=1) >>> SessionBus ().get_object ("org.bansheeproject.Banshee", "/org/bansheeproject/Banshee/PlayerEngine").GetCurrentTrack ()['artist'] dbus.String(u'Elton John', variant_level=1) >>> SessionBus ().get_object ("org.bansheeproject.Banshee", "/org/bansheeproject/Banshee/PlayerEngine").GetCurrentTrack ()['album'] dbus.String(u'Greatest Hits 1970-2002', variant_level=1) >>> SessionBus ().get_object ("org.bansheeproject.CollectionIndexer", "/org/bansheeproject/Banshee/PlayerEngine").GetRating () dbus.Byte(0) Reproduced on command line: bojan@Caprica:~$ banshee --query-title title: Crocodile Rock bojan@Caprica:~$ banshee --query-album album: Greatest Hits 1970-2002 bojan@Caprica:~$ banshee --query-artist artist: Elton John bojan@Caprica:~$ banshee --query-rating rating: Attached is a screenshot of the UI showing the song's rating.
If editing the track's settings manually and hitting Save, the rating is immediately available over DBus and the command line.
I can confirm this. Setting the rating through DBus, the Edit Track dialog, or the Rating widget on the track context menu will all update the rating correctly. But if you use the simplest method to change the rating (clicking on the rating widget directly) then the rating will update in the database and the ui, but the currently cached info for the track doesn't update.
Created attachment 179347 [details] [review] Allow rating widget to update currently playing track This should clear up the problem. It appears that clicking on the rating widget in a TrackListView is all handled through Hyena stuff, so there's no notification to the Player that the TrackInfo for the current track has changed. I just added a simple check when any TrackInfo rating is set to see if this track is the same as the track that's playing, and if so, make the appropriate changed and notifications.
*** Bug 641092 has been marked as a duplicate of this bug. ***
Copied from my other bug report: I'm running version 1.9.2 of Banshee. Playing a song then changing the rating while that song is still playing doesn't always update the rating that gets reported over DBus. I noticed this while using CoverGloobus to control Banshee. If I changed the rating in Banshee, the update wasn't showing in CoverGloobus. Using "banshee --query-rating" shows exactly the same problem as well. Note that the rating *does* get updated in the database, as well as visually in the UI, so this seems to be a problem of not properly updating the data in the cache for the currently playing track. I originally commented on bug 623183, but there doesn't seem to be any response to that bug (possibly because it's so old). So, I'm adding more information here. Upon further investigation, I found this problem did not happen in specific cases: -changing the rating through the status icon correctly updated the rating -changing the rating through the "Edit Track Information" dialog also correctly updated the rating -changing the rating through the rating widget on the track context menu (right-clicking on the track, then setting the rating) also correctly updated the rating -changing the rating through DBus (such as using CoverGloobus to change the rating), also correctly changed the rating. What doesn't work is changing the rating by directly left-clicking on any rating widget within a TrackListView (Playlist, any Library view, Play Queue). Again, the database successfully updates, as does the UI, the rating reported over DBus is incorrectly the old rating (the cache doesn't get updated). I did even more investigation and think I have found a solution to the problem. All the methods of changing the rating that do work correctly contain some code that updates the currently playing track cache, and sends a notification of that update. Clicking on the rating widget within a TrackListView, does not do any such updates. So, I added a few lines of code to the value setting function that the widget appears to use when it is clicked.
Bug still exists in 1.9.5. Any way someone could confirm and check out the patch I attached?
Review of attachment 179347 [details] [review]: I haven't tested this patch, but there are a few errors that I spotted in the code style, there may be more - see HACKING. Line indents should be consistant with souroumding text. Eg if (); is too far to the right. There should not be line breaks within brackets Also lines within a function should be indented further. There may be a few other nit-picks - hopefully a maintainer will point these out for you :-)
Created attachment 183290 [details] [review] Allow rating widget to update currently playing track
I made the mistake of using tabs instead of spaces. That's what I get for using MonoDevelop after being accustomed to Emacs.
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report. I committed the patch with a change : http://git.gnome.org/browse/banshee/commit/?id=9d32155 Instead of calling ExportableMerge which updates all the properties, we just need to update the Rating property for the current track.