[GSoC] smartplaylist: support multiple OR'ed conditions in a single rule #1079

merged 5 commits into from Jul 1, 2012


None yet
2 participants

Montellese commented Jun 16, 2012

These commits have the main purpose of adding support for multiple OR'ed conditions in a single rule. Currently this is only enabled for "browsable" fields/rules like Genre, Year, Studio etc. In the current implementation of smartplaylists the only way to get more complex conditions is to combine multiple playlists which is a bit cumbersome. With these changes it will be possible to go one step further in complexity by allowing conditions like "get all movies with genre Action or Drama or Thriller and year > 2000" without having to use two smartplaylists (one for the genre conditions and the other one combining the first one with the year condition). AFAIK these kind of filter conditions (a few internally OR'ed conditions which are combined with AND) are most popular e.g. in webshops etc and would also fit perfectly for my goal of advanced filtering i.e. the user chooses e.g. a few genres, maybe an actor or two and a condition on the rating.

To support this I had to extend the smartplaylist's XML representation with a way to store those OR'ed field values and I used additional < value > tags inside the existing < rule > tag. The old format of a string value inside the < rule > tag is still supported and used if there's only one value for a certain rule so backwards compatibility is maintained.

To be able to select multiple values for browsable fields in the smartplaylist rule editor I had to enable multi-selection in CGUIDialogSelect. When using CGUIDialogSelect with multi-selection I noticed that the only way to leave the dialog was to use ESC but for me ESC means "abort" and not "save" which in this case it did. So I changed CGUIDialogSelect to support the IsConfirmed() logic that is also present and in use for other dialogs.

Last but not least there is the problem of representing these OR'ed values in the smartplaylist editor. I've gone with " / " as a seperator but I'm open to suggestions. Furthermore up until now it was possible to manually type in a value for a browsable field but with the new format for OR'ed values this is very likely to cause problems and would require some kind of input validation before storing it in a smartplaylist. So I went down the road of making the input field read-only for browsable fields. Let me know if this is acceptable or not.

@ghost ghost assigned Montellese Jun 16, 2012


jmarshallnz commented Jun 19, 2012

I suggest just removing the facility to check based on CFileItemPtr's as it's not clear what we'd be testing on - I don't think you're using it anyway?


Montellese commented Jun 19, 2012

Yeah I'll remove that overloaded version of SetSelected().


Montellese commented Jun 20, 2012

@jmarshallnz OK I fixed everything you could find. Thanks for looking into it.

Montellese added a commit that referenced this pull request Jul 1, 2012

Merge pull request #1079 from Montellese/xsp_ext_ors
[GSoC] smartplaylist: support multiple OR'ed conditions in a single rule

@Montellese Montellese merged commit 12f9cb7 into xbmc:master Jul 1, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment