xbmc/xbmc — pull request #1692 by Montellese (2012-10-28 22:06:22+00:00)
Title: Options to (not) group movies into sets in smartplaylists

Currently the "Recently Added Movies" node in Video -> Library -> Recently Added Movies (which is a custom library node) behaves differently than the recently added movies node available through videodb://4/ and "Videos,RecentlyAddedMovies" (used by confluence for the "Recently Added" node in the "Movies" sub-menu). The list based on the custom library node, which is just a smartplaylist sorted by dateadded and limited to 25, groups the movies into sets which is not desirable IMO and therefore a bug. To remedy this we need to be able to specify that a list of movies retrieved through a smartplaylist should not group movies into sets independent of what a user has specified in the GUI settings. For that purpose I've added a new enum SmartPlaylistOption and a new member m_options to CSmartPlaylist. This option is currently not available in the GUI editor for smartplaylists but it can be specified through XMLs (which is all that is needed for custom library nodes). The main changes are in SmartPlaylist.h/.cpp and SmartPlaylistDirectory.cpp.

Most of the changes of this PR are a cleanup in the database code that I should have done before. During filtering we need to be able to retrieve those extra options from an XSP encoded in a URL which is possible through CDatabase::GetFilter() but we need to be able to pass this information back to the caller. Instead of adding yet another "reference out" parameter to retrieve that info I've replaced the existing reference parameters "filter" and "sortDescription" (which was added very recently) with a struct CDatabase::QueryData which contains all that information. That way we won't have to change the method definitions anymore next time we need to add new information that needs to be passed back to the caller.

If anyone has a better/easier way to achieve this I'm grateful for the feedback.