Re: [Imdbpy-devel] episodes rating fails

2010-05-29 Thread Davide Alberani
On May 29, David Kaufman david.kauf...@gmx.de wrote:

 To illustrate my example look at and you'll see the error right away:

Well, it's not an error: it's the expected behaviour. :-)
Let's follow the code:

 ia = IMDb('http')

In the above line, you can set the optional parameter loggingLevel
to debug to get a lot of information about what's going on.

 sp = ia.get_movie('0121955')

Here we get and parse the default info sets for a movie (i.e.: 'main'
and 'plot'):
  http://akas.imdb.com/title/tt0121955/combined
  http://akas.imdb.com/title/tt0121955/plotsummary

 ia.update(sp, episodes)

Here we're asking IMDbPY to fetch another info set ('episodes'):
  http://akas.imdb.com/title/tt0121955/episodes

By the way: for a list of available info sets, you can
call the ia.get_movie_infoset() method (there are corresponding
methods for companies, persons and characters, too).

 randomepisode = seasons[1][2]

randomepisode is a Movie instance created by the parser
of the episodes page, and it can contain only the information
available at that time.  I.e.: the ones in:
  http://akas.imdb.com/title/tt0121955/episodes

As you can see there's a plot, but not a rating, there.
At any time, you can see the list of information stored in
a Movie/Person/Character/Company object with: randomepisode.keys()

 print randomepisode.get(plot) #works
 print randomepisode.get(rating) #prints None

So, this is normal.

 Note that I actually could call ia.update(randomepisode) and the
 rating would appear but it's extremly slow.

Unfortunately, until you fetch/parse the main page about that
movie, your Movie instance can't contain the rating.

You can do two things to speed up at least a little your code:
1. use the 'mobile' data access system ( e.g.: ia = IMDb('mobile') )
   It uses a different set of parsers and fetches web pages which
   contain less information (but normally everything you need).
2. instead of a ia.update(randomepisode) call, you can do this:
   ia.update(randomepisode, 'main') to exclude at least the plot page.


HTH,
-- 
Davide Alberani davide.alber...@gmail.com [GPG KeyID: 0x465BFD47]
http://www.mimante.net/

--

___
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel


[Imdbpy-devel] episodes rating fails

2010-05-27 Thread David Kaufman
Hi Developers,

I think I found a bug with the current version of imdbpy (4.5.1).

When I try to retreive the episodes rating information of a
imdb_episode it simply prints None indicating
that there has been a KeyError exception:

ia.update(imdb_episode, episodes rating)
try:
rating = imdb_episode[episodes rating]
except KeyError:
rating = None

print rating

Can someone try to reproduce this error for episodes from South Park
for example.

Grettings,
David

--

___
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel


Re: [Imdbpy-devel] episodes rating fails

2010-05-27 Thread David Kaufman
Ah!

I was trying to get the rating from the episode itself, not from the
parent series.

Nonetheless I find it quite unintuitive to have to go over the series
to get to the ratings of a single epsiode.

Just my two cents. :)

Bye!

2010/5/27 Davide Alberani davide.alber...@gmail.com:
 On May 27, David Kaufman david.kauf...@gmx.de wrote:

 I think I found a bug with the current version of imdbpy (4.5.1).

 Hi!

 Can someone try to reproduce this error for episodes from South Park
 for example.

 I think it was fixed in the Mercurial repository on March 10:
  http://imdbpy.sf.net/?page=download#hg

 Unfortunately right now I'm extremely busy, and I can't release
 a new stable version before 3/4 weeks, sorry. :-/

 E.g.:
  from imdb import IMDb
  ia = IMDb('http')
  sp = ia.get_movie('0121955')
  ia.update(sp, 'episodes rating')
  print sp.get('episodes rating')


 Bye,
 --
 Davide Alberani davide.alber...@gmail.com [GPG KeyID: 0x465BFD47]
 http://www.mimante.net/


--

___
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel