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 319278 - Hidden songs are removed from playlists
Hidden songs are removed from playlists
Status: RESOLVED FIXED
Product: rhythmbox
Classification: Other
Component: general
HEAD
Other Linux
: Normal critical
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
: 325632 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-10-20 01:46 UTC by James "Doc" Livingston
Modified: 2006-01-16 06:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
1st patch (5.88 KB, patch)
2005-10-27 12:50 UTC, James "Doc" Livingston
none Details | Review
patch (6.40 KB, patch)
2005-12-13 03:22 UTC, James "Doc" Livingston
none Details | Review
mostly working patch (22.58 KB, patch)
2006-01-04 14:16 UTC, James "Doc" Livingston
reviewed Details | Review
updated patch (26.02 KB, patch)
2006-01-10 23:35 UTC, Jonathan Matthew
none Details | Review
updated patch (32.13 KB, patch)
2006-01-11 08:20 UTC, James "Doc" Livingston
committed Details | Review
patch to fix the build (860 bytes, patch)
2006-01-16 05:45 UTC, William Jon McCann
committed Details | Review

Description James "Doc" Livingston 2005-10-20 01:46:09 UTC
Rhythmbox doesn't show hidden (missing) files in queries, for obvious reasons.
One side-effect of this is that temporarily missing files will be removed from
normal playlists, and they shouldn't.
Comment 1 James "Doc" Livingston 2005-10-27 12:50:43 UTC
Created attachment 53945 [details] [review]
1st patch

This patch adds a "show-hidden" property to rb-query-model which is set for
non-automatic playlists - which means that missing tracks are still shown, and
hence aren't deleted from the playlist.

This could also be useful in implementing a "missing tracks" source that was
discussed a while back.
Comment 2 James "Doc" Livingston 2005-10-31 13:33:57 UTC
Two things that still need doing:

1) play-orders need to ignore any entry that has the hidden property set
2) the playlist source should make entries with the hidden property set gray,
have a special "missing" icon, or something to that effect.
Comment 3 James "Doc" Livingston 2005-12-03 11:37:24 UTC
*** Bug 323095 has been marked as a duplicate of this bug. ***
Comment 4 James "Doc" Livingston 2005-12-13 03:22:42 UTC
Created attachment 55924 [details] [review]
patch

This is updated to cvs. Still to do is making rb-static-playlist-source use a
filter model to hide the HIDDEN entries. That filter model could also be used
for browser/search for static playlists.
Comment 5 James "Doc" Livingston 2006-01-03 22:42:28 UTC
*** Bug 325632 has been marked as a duplicate of this bug. ***
Comment 6 James "Doc" Livingston 2006-01-03 22:44:06 UTC
Upgrading to critical since this is almost certain to blank all manual playlists when first upgrading from 0.9.2, and occasionally at other times too.
Comment 7 James "Doc" Livingston 2006-01-04 14:16:22 UTC
Created attachment 56774 [details] [review]
mostly working patch

This patch fixed the problem of hidden songs being removed and also adds support for the search box to static playlists. This still needs some work to fix ordering issues.


How it works:
The patch adds support for "query model chains", for which a later query model can only contain entries found in the previous model. These are set up by setting the "base-model" property on a query model.

The static playlist source uses these by creating two chained query models - the "base" model contains all tracks that have been added to the playlist, even hidden ones, and the "filter" model is used to remove hidden tracks and those that don't match the search box. The base model is the one that gets written out to disc, so that hidden tracks aren't lost.


To Do:
When entried are added to a model, they need to be put in the same order as the base model. This currently isn't done, which causes the ordering problems.


Notes:
I originally looked into using GtkTreeModelFilter for this (which would seem simpler). The problem is that although a GtkTreeModelFilter is a GtkTreeModel, it is not a RhythmDBQueryModel; most of the code would be fine handling GtkTreeModels, but there are a few places that use RhythmDBQueryModel-specific functions that can't operation on a filter model.



Any comments on whether people think "query model chains" are a sane way of doing this or suggestions would be much appreciated.
Comment 8 Jonathan Matthew 2006-01-08 05:41:27 UTC
A while ago, I decided for some reason that chained query models were necessary, or at least a good idea, but I can't remember what I wanted them for.

I think the query would work better if the filter model copied the base model contents when it was created, and we had a method to run the query over the existing query model contents, removing entries that didn't match.  I have a half-done library browser optimisation patch that does this too.

A couple of nits:
- should rhythmdb_query_model_base_entry_prop_changed only emit signals when the modified entry is in the filtered model?
- rb_static_playlist_source_finalize should call the parent class finalizer
- couldn't the static playlist just display the base model when there's no search text?

Comment 9 James "Doc" Livingston 2006-01-08 06:20:45 UTC
(In reply to comment #8)
> I think the query would work better if the filter model copied the base model
> contents when it was created, and we had a method to run the query over the
> existing query model contents, removing entries that didn't match.  I have a
> half-done library browser optimisation patch that does this too.

There are two ways of doing this:
a) take the contents of the base model, and remove the ones that don't match the query (your suggestion)
b) take the results of the query, and see if they are in the base model (how the patch does it).


Which one is more efficient depends on the size of the playlist, and exactly how the database is implemented. (b) will be more efficient when using browsers with large playlists, but this is going to be much less common than any other situation, so (a) is probably better. We can certainly change methods, I just picked one randomly to see how well the concept would work.


> A couple of nits:
> - should rhythmdb_query_model_base_entry_prop_changed only emit signals when
> the modified entry is in the filtered model?
> - rb_static_playlist_source_finalize should call the parent class finalizer

Yep, these need fixing.


> - couldn't the static playlist just display the base model when there's no
> search text?

The base model *must* contain all the entries in the playlist, including ones that are hidden, otherwise they will be lost (which is what this bug is actually about).

We could use the base model with hidden tracks visible, however we would need to ensure that they are never played, or any other synchronous operation done on them (which can lock up if they are a remote file). This is do-able, but would require changes in code above this, such as ignoring entry view activations, skipping them in play orders, never trying to edit tags on them etc.
Comment 10 Jonathan Matthew 2006-01-10 23:35:12 UTC
Created attachment 57135 [details] [review]
updated patch

Now copies the contents of the base model into the chained model, and uses a new method to reapply the query to the existing query model contents.

Also fixes the entry-changed signal emission, and chains up the finalize call.
Comment 11 James "Doc" Livingston 2006-01-11 08:20:20 UTC
Created attachment 57146 [details] [review]
updated patch

I've added code to the dnd function to deal with base models - in particular drops and deletes are passed to the base model to handle. Models also now listen for "row-reordered" signals from the base model, and re-order based on that.


The filtering model used by RBStaticPlaylistSource seems to get leaked; after it is unref'd when creating the new filter model, there is still one reference on it. I haven't tried using refdbg to trace this yet.
Comment 12 James "Doc" Livingston 2006-01-16 05:33:28 UTC
I've been using this few the past few days and haven't found any issues, so I've committed the patch to cvs.
Comment 13 William Jon McCann 2006-01-16 05:45:36 UTC
Created attachment 57452 [details] [review]
patch to fix the build 

This fixes the build for me.
Comment 14 James "Doc" Livingston 2006-01-16 06:03:42 UTC
Committed to cvs. thanks.