G'day everyone, I've got two more thing for everyone to have a look at. The first is on my arch branch (as usual) and fixes it so sorted & limited playlists work. This means that a "Sort by playcount, descending; limited to N songs" will give you a "N most played songs" playlist. The only problem with this is that you have to have a criteria for the playlist, even though not having any would make sense for this example. With one of my recent patches you can remove all of the criteria, but this will cause RB to die with an assert (I plan on fixing this soon). The second I've attached to the post, because it doesn't work directly on my branch (it requires things from Christophe's playbin branch). The attached patch restores some functionality from 0.8, which makes changes to ratings and playcount update automatic playlists (without having to quit). This partially makes a "N most played songs" work correctly - songs will get added and removed from the list, but it will no longer be sorted correctly (I'll also fix this soon). Now for my request for comments: fixing it so that playlists are updated when the rating of a songs changes bring up an issues that was in 0.8. What should happen if a song is removed from a playlist while it is playing? (this will be fairly common for anyone who has an "unrated songs" playlist). Currently it stops the song - which I don't think is the right thing to do, because I still want to be listening to it after I rate it as good. The other two options I can think of are to remove the song from the list (but don't stop it), or to remove the song from the list after it has finished playing. Any comments on what you think is best? Cheers, James "Doc" Livingston -- "It's times like this I wish I's listened to my Mother." "Why, what did she say?" "I don't know, I didn't listen."
--- orig/sources/rb-source.c +++ mod/sources/rb-source.c @@ -394,7 +394,7 @@ g_value_set_ulong (&value, current_count + 1); /* Increment current play count */ - rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_PLAY_COUNT, &value); + rhythmdb_entry_sync (db, entry, RHYTHMDB_PROP_PLAY_COUNT, &value); g_value_unset (&value); /* Reset the last played time */ @@ -402,8 +402,10 @@ g_value_init (&value, G_TYPE_ULONG); g_value_set_ulong (&value, now); - rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_LAST_PLAYED, &value); + rhythmdb_entry_sync (db, entry, RHYTHMDB_PROP_LAST_PLAYED, &value); g_value_unset (&value); + + rhythmdb_commit(db); } RBEntryView * --- orig/widgets/rb-entry-view.c +++ mod/widgets/rb-entry-view.c @@ -1506,16 +1506,18 @@ g_value_init (&value, G_TYPE_DOUBLE); g_value_set_double (&value, rating); - rhythmdb_entry_set (view->priv->db, entry, RHYTHMDB_PROP_RATING, + rhythmdb_entry_sync (view->priv->db, entry, RHYTHMDB_PROP_RATING, &value); g_value_unset (&value); /* since the user changed the rating, stop auto-rating */ g_value_init (&value, G_TYPE_BOOLEAN); g_value_set_boolean (&value, FALSE); - rhythmdb_entry_set (view->priv->db, entry, RHYTHMDB_PROP_AUTO_RATE, + rhythmdb_entry_sync (view->priv->db, entry, RHYTHMDB_PROP_AUTO_RATE, &value); g_value_unset (&value); + + rhythmdb_commit(view->priv->db); } static void
Attachment:
signature.asc
Description: This is a digitally signed message part