xbmc/xbmc — pull request #2182 by Montellese (2013-02-04 21:21:46+00:00)
Title: smartplaylists: add support for grouping

These commits contain a change and a new feature.

The change is that all the videodb:// and musicdb:// URLs, which up until now relied on numbers to indicate library views (i.e. videodb://1/2/ is the list of movies and videodb://1/8/ is the list of movie countries), have been changed to use strings i.e. videodb://movies/titles/ or videodb://movies/countries/ which makes it much easier to remember. The old system can still be used by skins etc to keep backwards compatibility. If preferred I can try to rip this change out into a seperate PR to clean things up a bit.

The new feature is support for grouping in smartplaylists. That means that a user can create a smartplaylist like "all action movies" and specify to group the list into countries and the result is a list of countries with action movies. Depending on the type of the smartplaylist different grouping options are available. For movies there are some special grouping options like "mixed set grouping" and "no grouping" which overwrites the "group movies into sets" GUI setting". In addition with the new GetItems() methods in CMusicDatabase and CVideoDatabase I was able to replace most of the grouping related videolibrary nodes in xbmc/filesystem/(Music|Video)DatabaseDirectory with a single CDirectoryNodeGrouped which saves some duplicate code.

This work is not yet finished but I need some feedback on the remaining problem: how to interprete the sort/order value set in a grouped smartplaylist. Most sorting options don't make sense in a grouped list (actually we only support "sort by label" but ascending and descending) but it would be still be nice to be able to specify the sort/order of the grouped media items. Should sort/order be disabled for grouped smartplaylists or should the sort/order option be applied to the grouped list (not the list of grouped items)?

Last but not least I just hacked the grouping options into Confluence so maybe @Jezz_X would like to clean that up a bit and make it look pretty.