Thanks for the fix and the comments, both helped a fair amount. Right now
I'm just working out how to store the data (re: the only somewhat difficult
part about the project). I was wondering, is there any part of code I might
have to change if I decide to use a MySQL database to access the data
instead of imdb's servers (besides when I initially create the IMDb object)?
As in, search_person and search_movie still work the same way and all of the
person or movie objects will have the same data as if I was using the http
access system?

Jon

On 5/19/07, Davide Alberani <[EMAIL PROTECTED]> wrote:

On May 18, Jon Sabo <[EMAIL PROTECTED]> wrote:

> I thought the movie object might have a cast attribute, but
> no luck.

It has, if the information about that movie were fetched.

> I'm not entirely sure how to do this, but the way I thought (see
> below) is throwing an error.

Eh. :-/
The recent redesign of the IMDb site has changed a lot of things,
and some of the parsers were rewritten from scratch (in a very small
amount of time), so it's normal that there are still bugs in it.
In the specific case, I think they have slightly modified their
web pages for movies still in productions, so you got a parser error.

In the CVS I've committed a fix.

> I still don't really understand the update method.

Your code is perfect; I'll try to comment it:

# put in resList a list of Person objects; these object will contain
# only the name (and the imdbIndex, if any) and the personID, since
# no other info is available from the search page.
>>>resList = i.search_person(u'edward norton')

# First result (beware that there can be zero results...)
>>>root = resList[0]

# The IMDbHTTPAccessSystem class (subclass of IMDbBase) does its magic
# to retrieve the more meaningful information about this person,
# specifically parsing the 'maindetails' and the 'bio' pages; you can
# alter this behavior with the "info" keyword of the update method
# (defined in the IMDbBase class).  For movies, the default is to
# fetch the 'combined' and 'plot' pages.
>>>i.update(root)

# The list of movies he acted in.
# Beware that the list is sorted in reverse chronological order, so
# the latest (maybe the _future_) releases are sorted first; in this
# case mov_list will be associated to a Movie object representing
# the "Motherless Brooklyn (2007) (announced)" movie.
# Obviously some people have not acted in a single movie (if they
# are just directors, writers, stunts or technicians of some sort).
# Also take care of the fact that females have the 'actress' keyword,
# so if you do not know the genre you can do:
#   list_of_movies = person.get('actor') or person.get('actress') or []
# These Movie instances don't have any information associated,
# besides title, year and optionals imdbIndex and production notes (if
# any) - oh, the the name of the character the person was impersonating
# in movie.currentRole (and notes in movie.notes) and as usual,
# the person.personID token.
>>>mov_list = root['actor']

# The first movie in the list.
>>>cur_mov = mov_list[0]

# Retrieve main information about this movie; as stated above,
# the 'combined' and 'plot' pages are fetched.
# Now you can iterate your process on the Person instances of
# the cur_mov['cast'] list.
>>>i.update(cur_mov)


HTH,
--
Davide Alberani <[EMAIL PROTECTED]> [PGP KeyID: 0x465BFD47]
http://erlug.linux.it/~da/

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel

Reply via email to