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 571105 - WISHLIST chaining of AND and OR logic in playlists
WISHLIST chaining of AND and OR logic in playlists
Status: RESOLVED WONTFIX
Product: banshee
Classification: Other
Component: Smart Playlists
1.4.2
Other All
: Normal enhancement
: 1.x
Assigned To: Banshee Maintainers
Gabriel Burt
gnome[unmaintained]
: 651804 666413 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-02-09 21:55 UTC by Chris Neary
Modified: 2020-03-17 08:33 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Chris Neary 2009-02-09 21:55:38 UTC
This should be a simple wishlist item to implement, I think.

Basically I'd like to be able to chain together a bunch of playlist filters with different logic conditions: AND, and OR. Let me simplify.

I may want to choose all songs which are have a genre of either 'Indie' or 'Rock', which is really simple to set up right now in Banshee. Simply create a Smart Playlist with these two conditions and select 'Match [ALL] of the following'.

However, I also want these two conditions to be passed through a final filter of songs which are at least 2 minutes long. I can't do that. They have to be either on of 'Indie' or 'Rock' or at least 2 minutes long. Or, they can be 'Indie' and 'Rock' and at least 2 minutes long. (Which is obviously impossible; songs can not have more than one genre in the field)

My suggestion is the ability to perhaps add another GUI frame (I think that's what GTK calls them, the border surrounding the 'Match [Any/All] of the following' section of the Smart Playlist editor; I have no idea what this is in Mono/Forms) and allow connection of AND & OR logic statements.

There we go, rather long-winded but I like to be verbose. I hope it's simple enough to understand and translate into working code. I know this sort of thing is already doable in the filter/search box, but I would like the ability to put this logic into a Smart Playlist that I don't have to construct the filter for each time I want to use it.

Alternatively I could conceive of constructing a filter in the search box and 'saving' that filter (which Banshee could simply remember as a database query I'd imagine) as a Smart Playlist.

Happy Implementing! ;)
Comment 1 Michael Martin-Smucker 2009-09-12 19:32:19 UTC
I agree completely.  Several times I've wished I could create complex playlists like this, especially now with the Score category.  I want a playlists with only artist1 OR artist2 OR artist3 Or artist4 AND I want all of the songs to have a score of at least 85.

So there's my enthusiastic +1.
Comment 2 Gabriel Burt 2009-10-27 20:16:22 UTC
Bulk changing the assignee to banshee-maint@gnome.bugs to make it easier for people to get updated on all banshee bugs by following that address.  It's usually quite apparent who is working on a given bug by the comments and/or patches attached.
Comment 3 Serrano Pereira 2010-03-15 00:27:36 UTC
I think any music player should have this functionality. It's sad to see that this feature hasn't been implemented yet. I've always wished to create complex playlists as described above.

Interestingly, I was able to construct these complex filters in the search box. So the search filter already allows for the creation of complex playlists. It should be possible to save these search queries in a Smart Playlist. If you can do that, than this issue would be solved.

This is an example for a search query. This matches any tracks whose genre contains "ambient", or, any tracks whose genre equals "industrial". Further restrict the search to match tracks whose rating is *also* not "1":

(genre:ambient or genre==industrial) -rating=1

Would it be difficult to save queries like these as a Smart Playlist?
Comment 4 Gabriel Burt 2010-03-15 03:45:20 UTC
No, it's not hard - smart playlists can already contain arbitrarily complicated queries, but we just don't have a UI for creating/editing them yet.  Long ago I started adding support for this via an alternative UI, just a search-like entry where you could type whatever you wanted, ideally with a way to switch to/from the old, visual UI (and not allowing you to if your query is too complicated).  Feel free to continue this effort - see src/Libraries/Hyena.Gui/Hyena.Query.Gui/
Comment 5 Jonathan Fritz 2010-09-06 18:00:48 UTC
This would be a great feature to have in banshee. +1 from me.
Comment 6 Michael Martin-Smucker 2011-06-03 21:16:07 UTC
*** Bug 651804 has been marked as a duplicate of this bug. ***
Comment 7 Age Bosma (IRC: Forage) 2011-10-30 20:14:06 UTC
Count my vote in for this feature as well.

As a workaround you can at least base one smart playlist on another to simulate the AND + OR behaviour by using "Smart Playlist" as one of the rules of the second playlist.
This can get messy with more complex rules though.
Comment 8 Matthias 2011-11-07 12:20:40 UTC
Is there a possibility to edit a smart playlist manually? Perhaps by editing the db?
Comment 9 Andrés G. Aragoneses (IRC: knocte) 2011-11-07 12:49:49 UTC
(In reply to comment #8)
> Is there a possibility to edit a smart playlist manually? Perhaps by editing
> the db?

According to comment#4, yes.
Comment 10 Serrano Pereira 2011-11-07 14:31:57 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > Is there a possibility to edit a smart playlist manually? Perhaps by editing
> > the db?
> 
> According to comment#4, yes.

I just tested this, and it works fine. I first created a regular smart playlist in Banshee. Then I extracted the smart playlist definition from the database with `sqlite`:

$ sqlite ~/.config/banshee-1/banshee.db
sqlite> SELECT Condition FROM CoreSmartPlaylists WHERE name='Favorite Rock';

Then manually edited the smart playlist definition in a text editor:

<request><query banshee-version="1">
    <and>
        <or>
            <contains><field name="genre" /><string>rock</string></contains>
            <contains><field name="genre" /><string>metal</string></contains>
        </or>
        <greaterThan><field name="rating" /><int>3</int></greaterThan>
    </and>
</query></request>

And finally updated the definition of the smart playlist in the database:

$ sqlite ~/.config/banshee-1/banshee.db
sqlite> UPDATE CoreSmartPlaylists SET Condition='<request><query banshee-version="1"><and><or><contains><field name="genre" /><string>rock</string></contains><contains><field name="genre" /><string>metal</string></contains></or><greaterThan><field name="rating" /><int>3</int></greaterThan></and></query></request>' WHERE name='Favorite Rock';

Restart Banshee and you're done. I now use this as a temporary solution until the GUI can handle complicated queries. I wanted to implement this part of the GUI myself, but I'm just too busy with school and other things.
Comment 11 Andrés G. Aragoneses (IRC: knocte) 2011-12-17 18:57:43 UTC
*** Bug 666413 has been marked as a duplicate of this bug. ***
Comment 12 deonix 2013-12-22 10:51:47 UTC
Any chance of working on the UI for this again? This is the only thing stopping me from using Banshee.
Comment 13 André Klapper 2020-03-17 08:33:18 UTC
Banshee is not under active development anymore and had its last code changes more than three years ago. Its codebase has been archived.

Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect
reality. Please feel free to reopen this ticket (or rather transfer the project
to GNOME Gitlab, as GNOME Bugzilla is being shut down) if anyone takes the
responsibility for active development again.
See https://gitlab.gnome.org/Infrastructure/Infrastructure/issues/264 for more info.