Thanks for answering so quickly.
I stripped a few things before I posted my script here, I accidently
deleted this: IMDb.update(serie, 'episodes')
I'm using version 3.6 because it's standard in ubuntu 8.10 and that's
probably what most of the users of my program will be using. But I will try
with 4.0 for testing purposes.
Since which version doesn't this work anymore: title =
serie['episodes'][1][4]['title'] ?
Will it work with imdbPy 3.8? (standard in ubuntu 9.04)
Since which version can I use sortedSeasons and sortedEpisodes? 3.8 or 4.0?
For getting the title I then would do title =
serie.get('episodes').get(1).get(4).get('title') and it will return None if
the title isn't available?
Best regards
Michael
2009/3/24 Davide Alberani <davide.alber...@gmail.com>
> On Mar 23, Michael Charclo <charclo.mich...@gmail.com> wrote:
>
> > I'm trying to get the title and plot of certain episodes of a serie.
>
> Hi!
>
> > import imdb
> > IMDb = imdb.IMDb()
>
> This name ("IMDb") could be a little confusing...
>
> > search_result = IMDb.search_movie('heroes')
> >
> > serie = search_result[0]
>
> Here you've to put, to retrieve information about episodes, this line:
> IMDb.update(serie, 'episodes')
>
> > title = serie['episodes'][1][4]['title']
> > plot = serie['episodes'][1][4]['plot']
>
> With the 'update' call, the above lines works, with IMDbPY 4.0.
>
> > What's the best way to get title and plot for an episode now?
>
> Some considerations:
> - update to 4.0; 3.6 is way too old.
> - instead of 'episodes', in the update call, you can use 'episodes cast',
> if you need also the complete cast of the episodes.
> - beware that accessing ['plot'] you take for grant that it exists,
> but it may be not. Using .get('plot') would be safer.
> More or less the same is true with season and episode numbers (1 and
> 4, in your example).
> In the imdb.helpers module there are the sortedSeasons and sortedEpisodes
> functions, useful to manage safely series seasons/episodes.
>
>
> Bye!
> --
> Davide Alberani <davide.alber...@gmail.com> [PGP KeyID: 0x465BFD47]
> http://erlug.linux.it/~da/ <http://erlug.linux.it/%7Eda/>
>
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel