GNOME Bugzilla – Bug 352637
automatic playlist editor cannot edit general boolean combinations
Last modified: 2018-05-24 11:47:11 UTC
Motivation: I wanted to make an automatic playlist with: (genre==metal || genre==rock) && (rating >= 3) I couldn't do this with the automatic playlist dialog because it can only do either A&&B&&..&&Z or A||B||..||Z but not more general combinations of boolean operators. I looked in the playlist.xml file and tried modifying it directly: <playlist name="Hip-hop (top rated)" type="automatic" sort-key="Artist" sort-direction="0"> <conjunction> <equals prop="type">song</equals> <subquery> <conjunction> <like prop="genre-folded">hip</like> <disjunction/> <like prop="genre-folded">rap</like> </conjunction> </subquery> <subquery> <conjunction> <greater prop="rating">3.000000</greater> </conjunction> </subquery> </conjunction> </playlist> In this case, it is supposed to match hip-hop or rap, rated >=3. And it works! Back in rhythmbox, if I try to edit the automatic playlist I get the following warning: (rhythmbox:15105): Rhythmbox-CRITICAL **: rb_query_creator_load_query: assertion `query->len == 2' failed sys:1: Warning: invalid (NULL) pointer instance sys:1: Warning: g_signal_connect_data: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed sys:1: GtkWarning: gtk_window_present_with_time: assertion `GTK_IS_WINDOW (window)' failed sys:1: GtkWarning: widget `GtkTable' isn't suitable for mnemonic activation Very cool! (I figured it would just crash.) I suppose a GUI that could handle very general cases might be too complicated. However, it seems to me that users might commonly want to be able to create the sort of playlist that I wanted. My only suggestion would be to allow the user to edit the xml structure directly through an "advanced" button. At the very least, if a user does manually edit the xml file, there should be a popup dialog that says "this playlist cannot be edited within Rhythmbox" or something like that when the query->len == 2 assertion fails.
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. This is a known issue, there is (probably outdated) patch on bug #320243 that might help. As you say the problem is the developing a GUI that could handle the different possible conditions. Closing as a duplicate. *** This bug has been marked as a duplicate of 320243 ***
Bug 320243 is about the search box, not the query editor.
So it is. Hmm, I was sure that there was an open bug on this in the auto playlist context, it could have been discussed under some other bug. Either way, they are both related because currently the query engine handles these more complex queries, but we currently have no way of exposing that to the user (either via the search box or the auto playlist editors).
If there was a way of converting the XML representation back to the format (and used in the rhythmdb_query_to_string() and from this representation back to XML then maybe the query box could be toggled to display a user-editable text representation like: "(artist =~ foo) || (genre != bar)" Of course that would need to be parsed, and the parser would refuse to save syntatically incorrect queries. For already created playlists, it would open up the query in the regular GUI window only if it was simple enough to be represented that way, otherwise it would show the above representation. Anyway, simple enough conceptually but would probably be a considerable amount of work. I don't think editing the XML directly would be a good idea though.
Re: comment #4. If we're going to do all that, why bother with the XML syntax at all? Why not save the queries in the format you suggest or as regex's or as SQL queries or whatever?
Because it ultimately needs to be translated into format like XML to be parsed, plus the serialisation/deserialisation code is already written. The syntax I propose is already used in debugging and is human readable/typeable in a way that the XML is not. From what I can tell of the code, syntax is already isomorphic to the existing XML and converting from one to the other shouldn't be too much of a problem. Jonathan Matthew or James Livingston, who are the primary maintainers should be able to say more than I can. (I'm not an official developer, just a tester and occasional patch contributor and I still learning the code).
I can't believe this feature hasn't been implemented yet. I think the idea proposed by Alex in comment #4 would be the best solution. I'm craving for this functionality so much that I'm actually willing to create a patch myself. If only I knew where to start.. Can anyone tell me if there has been any progress on this issue?
There has been no progress on this. No one is working on it.
*** Bug 621784 has been marked as a duplicate of this bug. ***
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/rhythmbox/issues/229.