Add "AND/OR" filter rules for Smart Playlists and Nodes
#1
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!
Reply
#2
(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
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#3
you even can wrap those MPAA ratings into a single rule.

Image

resulting .xsp file:
xml:
<?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>
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#4
Even better Smile
My Signature
Links to : Official:Forum rules (wiki) | Official:Forum rules/Banned add-ons (wiki) | Debug Log (wiki)
Links to : HOW-TO:Create Music Library (wiki) | HOW-TO:Create_Video_Library (wiki)  ||  Artwork (wiki) | Basic controls (wiki) | Import-export library (wiki) | Movie sets (wiki) | Movie universe (wiki) | NFO files (wiki) | Quick start guide (wiki)
Reply
#5
Wow!! Wait a minute. So is the slash '/' the 'or' operator here? If so, what would be the & operator (unless it's just '&' lol)...
Reply
#6
The match all rules is the and operation
Reply
#7
If I want only show the right movies for my children i will like genre PG, the weird thing is they show me tvshows not movies.... te file is alocate in playlists\video\file.xps
any help

   <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="movies">
    <name>Samuel MPG</name>
    <match>all</match>
  
 <rule field="mpaarating" operator="is">
    <value>G</value>
    <value>PG</value>
   </rule>
    <group>years</group>
    <limit>100</limit>
    <order direction="descending">lastplayed</order>
</smartplaylist>
Reply
#8
I also have an "and/or" requirement to try and accomplish.

I have many cooking shows, and want to setup nodes to "search" for a static term (like "Chicken").

I do have nodes setup, like:

<node type="filter">
    <label>Chicken</label>
    <content>episodes</content>
    <match>one</match>
    <rule field="plot" operator="contains">
        <value>Chicken</value>
    </rule>
    <rule field="title" operator="contains">
        <value>Chicken</value>
    </rule>
</node>

And while this does work in as far as "searching" for "Chicken" in the Title OR Plot , I'd like to somehow also filter on tvshow genre "Food" , but I don't see how to do so as it would require and and/or type setup for the node.

Any ideas on being able to pull this off short of a custom built addon to do this?

EDIT:
Figured out a way with Smart Playlists (not sure can do this in nodes), but in case someone has similar needs, this allows "AND/OR" type logic for Smart Playlists:

1) Playlist to filter just Food genre in episodes:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Food Series</name>
    <match>one</match>
    <rule field="genre" operator="is">
        <value>Food</value>
    </rule>
</smartplaylist>


2) Playlist to list all episodes with "Chicken" in Title or Plot:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>z_has_Chicken</name>
    <match>one</match>
    <rule field="plot" operator="contains">
        <value>Chicken</value>
    </rule>
    <rule field="title" operator="contains">
        <value>Chicken</value>
    </rule>
</smartplaylist>

3) The "real" Chicken Playlist now references the previous 2:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Chicken</name>
    <match>all</match>
    <rule field="playlist" operator="is">
        <value>Food Series</value>
    </rule>
    <rule field="playlist" operator="is">
        <value>z_has_Chicken</value>
    </rule>
</smartplaylist>

I now have many cooking related terms setup with pairs of playlists (#2 and #3, get to re-use #1 for each pair) to navigate recipes.
Reply

Logout Mark Read Team Forum Stats Members Help
Add "AND/OR" filter rules for Smart Playlists and Nodes0