xbmc/xbmc — pull request #1079 by Montellese (2012-06-16 11:38:23+00:00)
Title: [GSoC] smartplaylist: support multiple OR'ed conditions in a single rule

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.