xbmc/xbmc — pull request #1000 by Montellese (2012-05-23 22:25:00+00:00)
Title: Movie set fixes and sorting improvements

These commits add a fix for the following set-related problem: The problem is that we only retrieve sets if they contain more than one movie (which is handled through SQL's COUNT() and GROUP BY on the setlinkmovie table). The existing logic does not take into account special WHERE conditions like when browsing movies by years which can result in a set being found which usually contains multiple movies but combined with the special WHERE condition, only one movie matches the whole query. In that case up until now neither the set containing the matching movie nor the movie itself were listed.

Furthermore they implement a new way to retrieve sets by going through all the movies belonging to the set and using their metadata (currently year, rating, lastplayed, dateadded and playcount) to calculate the metadata for the whole set (e.g. the average of all the ratings). This allows sets to be sorted like movies in a list instead of just treating them as folders and putting them at the top/bottom of the list.

As a result of the new available metadata for sets I also added the respective sorting methods to the sets node in the video library.

Theoretically skins could use these new metadata values and display them for sets like they do for movies but only the above mentioned properties (year, rating, lastplayed, dateadded and playcount) are currently automatically filled and therefore available.