Adding Support for Sets of Movies - Sorting Issue
#1
I have been working for a little bit on adding support for sets of movies. The idea is to enable grouping movies together by sets. I have gotten the database stuff working as well as reading from and writing to the .nfo files. With an entry in the .nfo like this:
Code:
<sets>
  <set order="1">Harry Potter</set>
  <set order="3">Another Set</set>
</sets>
I can make Harry Potter and the Sorcerer's Stone the first movie in the Harry Potter set and the third movie in Another Set. That is all well and good. I have created two tables in the database. The first one is called "sets" and contains the fields "idSet" (unique index) and "strName". The other is called "setlinkmovie" and contains three fields: "idSet", "idMovie", and "iSetOrder". These tables are analogous to the actor and actorlinkmovie tables, with iSetOrder denoting the order of the movie within the set.

Once I got the database stuff working, I set about displaying the sets. Looking at how the grouping works for genres, studio, directors, etc, I made a "Sets" grouping on the movie overview page. I can get the sets displayed and the movies within the sets displayed. My problem comes with sorting. I created a method to sort the movies based on the iSetOrder. The VideoInfoTag has a struct SSetInfo containing strName and strOrder. There is then a vector m_sets containing as many SSetInfo's as necessary and an iterator iSets used to step through the various SSetInfo's. (These are analogous to m_Cast and iCast.) The sorting method then looks for the set order from m_sets. As long as each movie is the member of only one set, this works just fine. But, if it is a member of multiple sets (as in the above example), it assigns the set order of the last set associated with the movie.

What I need is a way to pass the name of the Set I am sorting to the sorting method. As it is, I can't find a way to do that. I could create another (overloaded) CFileItemList::Sort with an extra argument consisting of the Set name just to handle this case (which will also require an overloaded CFileItemList::FillSortFields), but I can't figure out exactly where CFileItemList::Sort is called from and how to properly get the Set name to pass to it. If anyone can point me to how to do this, I would greatly appreciate it. Or, if you have any suggestions for another way to handle the sorting by SetOrder, I could try that. I can post a patch of what I have so far if anyone would like to have a look.
Thanks,
Joel
Reply
#2
sorting happens in GUIMediaWindow.cpp, ::FormatAndSort.

if i understand correctly, you have no choice but to special case your stuff
Reply
#3
Thanks. I think I have figured out what I need to do now. I still have some bugs to work out, but at least I know where to look. I will probably be back with some more questions after I play with it some more.
Joel
Reply

Logout Mark Read Team Forum Stats Members Help
Adding Support for Sets of Movies - Sorting Issue0