squentin / gmusicbrowser

jukebox for large collections of music
http://gmusicbrowser.org
GNU General Public License v3.0
194 stars 42 forks source link

How to filter playlist on a single genre only? #236

Open MountainX opened 2 years ago

MountainX commented 2 years ago

Let's say I want to filter my playlist on the Blues genre and I don't want any songs that also have any additional genres. How can I do this?

I tried the regex filter like this: ^Blues$

However, it still matches songs that have additional genres as long as Blues is one of them. I'm looking for a way to exclusively match Blues and only Blues.

The only solution I see is something like this:

All of: genre includes Blues genre doesn't contain Rock genre doesn't contain Folk genre doesn't contain (a very long list of genre doesn't contain )

After building that complex filter, it is very fragile in the sense that adding a new genre can make it not perform as expected. So it is not a good solution.

I would think there is a better solution. Can anyone suggest one?

squentin commented 2 years ago

Yes it's not currently possible. But it shouldn't be hard to add. I can see 2 ways of doing this.

  1. add a way to filter on a string containing the list of genres
  2. add a way to filter on the number of genres

The first solution requires choosing a format with a separator ie: "a; b; c", and would need both the substring and regex variants, so I don't like it much. It could easily be done with a virtual "genres" field, but it would be a bit messy to add a virtual field for every field of this type.

The second solution is easier, there is already a filter that checks if the number of genres is equal to 0, so it would extend that. I'm just not sure it covers all the likely uses. There are some things you can do with 1 and not with 2 and vice-versa.

Also I'll have to think of the smart-filter syntax for it, so you could type maybe: "genre=Blues genre#=1" or genre==1

Any thoughts ?

MountainX commented 2 years ago

Thank you. Your 2nd option seems fine to me. The smart-filter syntax you proposed for it, like: "genre=Blues genre#=1" seems OK too. It looks clear. It looks like that would achieve the result I'm after.