After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 623183 - Song rating isn't available outside the UI until restart
Song rating isn't available outside the UI until restart
Status: RESOLVED FIXED
Product: banshee
Classification: Other
Component: Metadata
1.7.1
Other Linux
: Normal minor
: 1.x
Assigned To: Banshee Maintainers
Banshee Maintainers
: 641092 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-06-30 00:18 UTC by bojanr
Modified: 2011-03-19 18:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot of the UI showing the song's rating (368.02 KB, image/png)
2010-06-30 00:18 UTC, bojanr
  Details
Allow rating widget to update currently playing track (1.35 KB, patch)
2011-01-26 00:33 UTC, Mackenan Grassi
needs-work Details | Review
Allow rating widget to update currently playing track (1.42 KB, patch)
2011-03-13 19:00 UTC, Mackenan Grassi
none Details | Review

Description bojanr 2010-06-30 00:18:34 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.
Comment 1 bojanr 2010-06-30 00:31:56 UTC
If editing the track's settings manually and hitting Save, the rating is immediately available over DBus and the command line.
Comment 2 Mackenan Grassi 2011-01-25 00:08:08 UTC
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.
Comment 3 Mackenan Grassi 2011-01-26 00:33:05 UTC
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.
Comment 4 Alexander Kojevnikov 2011-02-01 00:36:04 UTC
*** Bug 641092 has been marked as a duplicate of this bug. ***
Comment 5 Mackenan Grassi 2011-02-01 01:02:53 UTC
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.
Comment 6 Mackenan Grassi 2011-03-13 08:19:30 UTC
Bug still exists in 1.9.5. Any way someone could confirm and check out the patch I attached?
Comment 7 Matt Sturgeon 2011-03-13 10:30:31 UTC
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 :-)
Comment 8 Mackenan Grassi 2011-03-13 19:00:10 UTC
Created attachment 183290 [details] [review]
Allow rating widget to update currently playing track
Comment 9 Mackenan Grassi 2011-03-13 19:01:18 UTC
I made the mistake of using tabs instead of spaces. That's what I get for using MonoDevelop after being accustomed to Emacs.
Comment 10 Bertrand Lorentz 2011-03-19 18:23:44 UTC
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.