Kodi Community Forum

Full Version: Add "AND/OR" filter rules for Smart Playlists and Nodes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The current implementation of 'rules' for smart playlists and nodes is quite limiting.

For example, creating the following smart playlist is (while not impossible) very long winded and probably wouldn't work properly anyway. This is because the current setup is using the 'items must match all rules'/'items must match one or more rules' instead of AND/OR operators for each rule.

Example rule to set up: only have movies that are either an Action movie or a Thriller, but is not rated below a PG-13.

If (like in Plex) AND/OR operators were available, the setup would be as simple as:

Genre is: Action OR Thriller
MPAA Rating is not: G or PG


However, since they're not, the setup become much more complicated being:

Items Must Match all Rules
Genre is not: Comedy
Genre is not: Musical
Genre is not: Drama
Genre is not: SciFi
Genre is not: (*All genres except Action/Thriller basically*)
MPAA Rating is not: G
MPAA Rating is not: PG


As you can see, that is a very long winded way of having to do it, and I don't think it would even work, since you can have an action or thriller movie that's also scifi for example. If I were to set it to 'Genre IS: Action, Genre IS: Thriller', then it'll only show movies that have both the Action AND Thriller genre tags attached to them.


Plex seem to how it down the best, and the first example is taken from the way Plex filter rules work:
  1. You simply select the 'thing(s)' you want to filter (such as genre, mpaa, length, studio etc)
  2. Then select the filter options you want (is, is not, contains, does not contain, begins with, ends with, is before, is after, in the last, not in the last)
  3. Then select/enter the actual word/phrase you want to filter (Action OR Thriller etc) with an AND/OR between each of the genres (in this case).

I imagine this has been asked about tonnes of times, and I did have a scout around for any kind of voting system for feature requests etc, but couldn't find anything.

Please consider implementing this as it would make Kodi's smart Playlists, Nodes & the Widgets much more powerful & customisable.

Cheers!
(2020-06-28, 17:32)smernt Wrote: [ -> ]For example, creating the following smart playlist is (while not impossible) very long winded and probably wouldn't work properly anyway. This is because the current setup is using the 'items must match all rules'/'items must match one or more rules' instead of AND/OR operators for each rule.
Not correct. This will work...

Image
you even can wrap those MPAA ratings into a single rule.

Image

resulting .xsp file:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="movies">
    <name>test</name>
    <match>all</match>
    <rule field="genre" operator="is">
        <value>Action</value>
        <value>Thriller</value>
    </rule>
    <rule field="mpaarating" operator="isnot">
        <value>G</value>
        <value>PG</value>
    </rule>
</smartplaylist>
Even better Smile
Wow!! Wait a minute. So is the slash '/' the 'or' operator here? If so, what would be the & operator (unless it's just '&' lol)...
The match all rules is the and operation