Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

smartplaylist extensions & extended filtering in JSON-RPC #1258

Merged
merged 4 commits into from Sep 3, 2012

Conversation

Projects
None yet
2 participants
Owner

Montellese commented Aug 7, 2012

This PR contains two commits which add two features (the second requiring the first):

  1. adds support for nested AND/OR rules in smartplaylists. Currently it is only possible to either do AND or OR (and then a nested OR on a single rule which I added as part of my GSoC work). With these changes it is possible to specify any combination of nested rules combined with AND or OR. Because there's no sane way to represent this in the GUI (or I'm too stupid to think of it) this feature is limited to C++ object based and CVariant based representations of a smartplaylist. XML still uses the same old representation.
  2. adds basic XSP based filtering to the following JSON-RPC methods in the VideoLibrary and AudioLibrary namespaces: GetMovies, GetTVShows, GetEpisodes, GetMusicVideos, GetAlbums and GetSongs (once #1249 has been merged I can add it to GetArtists as well). To use XSP based filtering clients can specify rules and their combination type (AND or OR) in JSON and pass them in the "filter" parameter. Currently only one level of nested combination is possible (same as in the GUI) because I haven't figured out yet how to represent the recursive nature of nested AND/OR combinations of smartplaylist rules in JSON schema yet (I know that it's possible but it will require changes to our JSON schema parser). The current JSON schema definition contains automatic validation of the fields used in the rules i.e. it's not possible to e.g. specify a rule with a "artist" field in GetMovies. But there's no value/type/operator checking (probably not possible at all with the current JSON schema definition etc).

UPDATE:
I managed to support recursive JSON schema type definitions. With this it's now possible to create XSP-based filter objects of virtually any level of complexity. You can e.g. have two rules ORed together in an AND block together with another rule as in this example

"filter": {
  "and": 
  [
    { "or": 
      [
        { "field": "genre", "operator": "is", "value": "Action" },
        { "field": "genre", "operator": "is", "value": "Adventure" }
      ]
    },
    { "field": "year", "operator": "is", "value": "2011" } 
  ]
}

Which would return all items (e.g. movies) which were released in 2011 and have Action or Adventure (or both) as a genre.

@ghost ghost assigned Montellese Aug 9, 2012

Owner

Montellese commented Aug 9, 2012

I managed to support recursive JSON schema type definitions. With this it's now possible to create XSP-based filter objects of virtually any level of complexity. You can e.g. have two rules ORed together in an AND block together with another rule as in this example

"filter": {
  "and": 
  [
    { "or": 
      [
        { "field": "genre", "operator": "is", "value": "Action" },
        { "field": "genre", "operator": "is", "value": "Adventure" }
      ]
    },
    { "field": "year", "operator": "is", "value": "2011" } 
  ]
}

Which would return all items (e.g. movies) which were released in 2011 and have Action or Adventure (or both) as a genre.

Member

jmarshallnz commented Aug 12, 2012

Nice work :)

Owner

Montellese commented Aug 20, 2012

I've added extended filtering to AudioLibrary.GetArtists as well. Furthermore it is now possible to define a single filter rule without having to wrap it in an "and" or an "or" object which is much more intuitive (and has already been requested in the forum).

Montellese added a commit that referenced this pull request Sep 3, 2012

Merge pull request #1258 from Montellese/gsoc_xsp_and_or
smartplaylist extensions & extended filtering in JSON-RPC

@Montellese Montellese merged commit 85ed7ec into xbmc:master Sep 3, 2012

@Montellese Montellese deleted the Montellese:gsoc_xsp_and_or branch Apr 4, 2014

LongChair added a commit to plexinc/plex-home-theater-public that referenced this pull request Aug 1, 2014

LongChair added a commit to plexinc/plex-home-theater-public that referenced this pull request Apr 30, 2015

Reset selected item to 0 if we dont have a valid stored selection, fixes
 #1258

MediaWindow was keeping the last mediawindow selected item ID when we didnt find a valid section  markup. This was causing section selection to remain across sections on first entry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment