On Jul 07, Alain MICHEL <[EMAIL PROTECTED]> wrote:
> I have accidentally bumped into IMDbPY which is a lot more robust
> than the few buggy lines I had written. So thanks for your work,
> it helps me a lot.
:-)
Lets say IMDbPY has a huge, well documented, set of bugs. ;-)
> During my tests I've found something strange with get_movie.py,
> it works fine through the web but when I set it to local or sql,
> it doesn't return the good movie.
You're right, it depends on a false assumption I've made when I wrote
these little example scripts 2 years ago: in the search_movie.py script,
showing the results, the script calls the get_imdbMovieID method of
the IMDb object.
This means that the ID that is showed is _always_ the imdbID (the one
used on the imdb.com site: 0133093 in you example for The Matrix).
As a proof, running the script on a off-line computer will print
a list of "None" as IDs.
This is especially wrong using "local" or "sql" data access systems:
locally there's no way to know the imdbID (again: the one used by the
imdb.com site) for a given movie or person, so we have to use another
identifier: for "local" you can find these IDs in the titles.key and
names.key files (were they are expressed in hexadecimal), while for
"sql" they are the "id" column in Title and Name tables.
Solution [1]: the search_movie.py and search_person.py scripts now
return three columns:
movieID/personID : imdbID : title/name
The first is the one you'll use as parameter for the get_movie.py and
get_person.py scripts [2], the second (None if you're not on-line) is
the ID used by the imdb.com site.
Within your scripts, you can always (provided that you're online!)
convert a "local" or "sql" movieID/personID into the corresponding
imdbID calling the get_imdbID method. E.g.:
from imdb import IMDb
i = IMDb('local', '/my/dir/to/imdb/files')
m = i.search_movie('The Matrix')[0] # the first movie in the results.
print m.movieID
# will print a movieID dependant on your "local" installation,
# like "564626" on mine system.
print i.get_imdbID(m)
# will print 0133093, the "real" unique imdbID.
> So it seems that there's no reference to the imdb id in the plain
> text data files they provide.
Right, that's why movieID and personID in IMDbPY are "relative concepts",
depending on the data access system you're using (incidentally for "http"
and "mobile" they correspond to the imdbID).
Thank you very much for the bug report: I'll add your name to the
credits. :-)
+++
[1] already committed to the CVS, it will be visible within few hours.
[2] provided that get_movie.py and search_movie.py are configured in the
same way! - this makes me think that a system-wide configuration
can be a good idea...
--
Davide Alberani <[EMAIL PROTECTED]> [PGP KeyID: 0x465BFD47]
http://erlug.linux.it/~da/
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Imdbpy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel