On Jun 27, Mike Castle <dalg...@gmail.com> wrote: > I assume that the bit that processes XML or whatever would be the > ideal place to have a counter to keep track of it?
Sure, or - even better - rethink the data structure: after all, maybe we don't really need a dictionary of dictionaries to store seasons/episodes. The current choice was probably made to accomodate things like "unknown season" or "episode 0", but maybe we don't need these pieces of information and move to a list of lists or a dictionary of lists. > But I was busy and didn't have time to figure out your entire > code base. :-> Feel free to poke around, clone/fork the repository, and ask if you need help! > For a personal fix, I ended up using just an integer [...] > I've not yet looked at yours, though. It does the same. :-) > I suppose on of the problems with this is that there is no good > way to guarantee an order. That's why there are the sortedSeasons and sortedEpisodes functions in the 'helpers' module (but they can't guarantee to return the same order you've read on the web page). Hmmm... I've to think more carefully about it, but right now I'm inclined to use a dictionary of lists (keeping the 'season' a key in a dictionary - when possible an integer - and the list of episodes as its values). E.g., for movie['episodes']: {1: [Movie1.1, Movie1.2, ...], 2: [Movie2.1, Movie2.2, ...], 'unknown': [MovieX.1, MovieX.2, ...]} Where MovieX.Y obviously are Movie instance, like now. What do you think? Thanks for your help! -- Davide Alberani <davide.alber...@gmail.com> [GPG KeyID: 0x465BFD47] http://www.mimante.net/ ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Imdbpy-help mailing list Imdbpy-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/imdbpy-help