Upgrading to GitLab 11.10.0. Expect errors and see debian-infrastructure-announce@lists.debian.org for further information.

Commit 06871e6e authored by Ana Guerrero López's avatar Ana Guerrero López

Import Upstream version 2.6

parents
#
# MANIFEST.in
#
# Manifest template for creating the Distutils source distribution.
#
# Comment out the "recursive-include docs" entry if you don't want
# to install the documentation.
recursive-include docs *
global-exclude *~
prune CVS
# Uncomment the following line if you don't want to install the logo images.
# exclude docs/*.png docs/*.xpm docs/*.bmp
#!/usr/bin/env python
"""
get_first_movie.py
Usage: get_first_movie "movie title"
Search for the given title and print the best matching result.
"""
# Parameters to initialize the IMDb class.
IMDB_PARAMS = {
# The used access system. 'web' means that you're retrieving data
# from the IMDb web server.
'accessSystem': 'web'
#'accessSystem': 'mobile'
# XXX: if you've a local installation of the IMDb database,
# comment the above line and uncomment the following two.
#'accessSystem': 'local',
#'dbDirectory': '/usr/local/imdb' # or, in a Windows environment:
#'dbDirectory': 'D:/imdb-20060107'
# XXX: parameters for a SQL installation.
#'accessSystem': 'sql',
#'uri': 'mysql://userName:yourPassword@localhost/dbName'
}
import sys
# Import the IMDbPY package.
try:
import imdb
except ImportError:
print 'You bad boy! You need to install the IMDbPY package!'
sys.exit(1)
if len(sys.argv) != 2:
print 'Only one argument is required:'
print ' %s "movie title"' % sys.argv[0]
sys.exit(2)
title = sys.argv[1]
i = imdb.IMDb(**IMDB_PARAMS)
in_encoding = sys.stdin.encoding or sys.getdefaultencoding()
out_encoding = sys.stdout.encoding or sys.getdefaultencoding()
title = unicode(title, in_encoding, 'replace')
try:
# Do the search, and get the results (a list of Movie objects).
results = i.search_movie(title)
except imdb.IMDbError, e:
print "Probably you're not connected to Internet. Complete error report:"
print e
sys.exit(3)
if not results:
print 'No matches for "%s", sorry.' % title.encode(out_encoding, 'replace')
sys.exit(0)
# Print only the first result.
print ' Best match for "%s"' % title.encode(out_encoding, 'replace')
# This is a Movie instance.
movie = results[0]
# So far the Movie object only contains basic information like the
# title and the year; retrieve main information:
i.update(movie)
print movie.summary().encode(out_encoding, 'replace')
#!/usr/bin/env python
"""
get_first_person.py
Usage: get_first_person "person name"
Search for the given name and print the best matching result.
"""
# Parameters to initialize the IMDb class.
IMDB_PARAMS = {
# The used access system. 'web' means that you're retrieving data
# from the IMDb web server.
'accessSystem': 'web'
#'accessSystem': 'mobile'
# XXX: if you've a local installation of the IMDb database,
# comment the above line and uncomment the following two.
#'accessSystem': 'local',
#'dbDirectory': '/usr/local/imdb' # or, in a Windows environment:
#'dbDirectory': 'D:/imdb-20060107'
# XXX: parameters for a SQL installation.
#'accessSystem': 'sql',
#'uri': 'mysql://userName:yourPassword@localhost/dbName'
}
import sys
# Import the IMDbPY package.
try:
import imdb
except ImportError:
print 'You bad boy! You need to install the IMDbPY package!'
sys.exit(1)
if len(sys.argv) != 2:
print 'Only one argument is required:'
print ' %s "person name"' % sys.argv[0]
sys.exit(2)
name = sys.argv[1]
i = imdb.IMDb(**IMDB_PARAMS)
in_encoding = sys.stdin.encoding or sys.getdefaultencoding()
out_encoding = sys.stdout.encoding or sys.getdefaultencoding()
name = unicode(name, in_encoding, 'replace')
try:
# Do the search, and get the results (a list of Person objects).
results = i.search_person(name)
except imdb.IMDbError, e:
print "Probably you're not connected to Internet. Complete error report:"
print e
sys.exit(3)
if not results:
print 'No matches for "%s", sorry.' % name.encode(out_encoding, 'replace')
sys.exit(0)
# Print only the first result.
print ' Best match for "%s"' % name.encode(out_encoding, 'replace')
# This is a Person instance.
person = results[0]
# So far the Person object only contains basic information like the
# name; retrieve main information:
i.update(person)
print person.summary().encode(out_encoding, 'replace')
#!/usr/bin/env python
"""
get_movie.py
Usage: get_movie "imdbID"
Show some info about the movie with the given imdbID (e.g. '0133093'
for "The Matrix".
"""
# Parameters to initialize the IMDb class.
IMDB_PARAMS = {
# The used access system. 'web' means that you're retrieving data
# from the IMDb web server.
'accessSystem': 'web'
#'accessSystem': 'mobile'
# XXX: if you've a local installation of the IMDb database,
# comment the above line and uncomment the following two.
#'accessSystem': 'local',
#'dbDirectory': '/usr/local/imdb' # or, in a Windows environment:
#'dbDirectory': 'D:/imdb-20060107'
# XXX: parameters for a SQL installation.
#'accessSystem': 'sql',
#'uri': 'mysql://userName:yourPassword@localhost/dbName'
}
import sys
# Import the IMDbPY package.
try:
import imdb
except ImportError:
print 'You bad boy! You need to install the IMDbPY package!'
sys.exit(1)
if len(sys.argv) != 2:
print 'Only one argument is required:'
print ' %s "imdbID"' % sys.argv[0]
sys.exit(2)
imdbID = sys.argv[1]
i = imdb.IMDb(**IMDB_PARAMS)
out_encoding = sys.stdout.encoding or sys.getdefaultencoding()
try:
# Get a Movie object with the data about the movie identified by
# the given imdbID.
movie = i.get_movie(imdbID)
except imdb.IMDbError, e:
print "Probably you're not connected to Internet. Complete error report:"
print e
sys.exit(3)
if not movie:
print 'It seems that there\'s no movie with imdbID "%s"' % imdbID
sys.exit(4)
# XXX: this is the easier way to print the main info about a movie;
# calling the summary() method of a Movie object will returns a string
# with the main information about the movie.
# Obviously it's not really meaningful if you want to know how
# to access the data stored in a Movie object, so look below; the
# commented lines show some ways to retrieve information from a
# Movie object.
print movie.summary().encode(out_encoding, 'replace')
# Show some info about the movie.
# This is only a short example; you can get a longer summary using
# 'print movie.summary()' and the complete set of information looking for
# the output of the movie.keys() method.
#print '==== "%s" / imdbID: %s ====' % (movie['title'], imdbID)
# XXX: use the IMDb instance to get the IMDb web URL for the movie.
#imdbURL = i.get_imdbURL(movie)
#if imdbURL:
# print 'IMDb URL: %s' % imdbURL
#
# XXX: many keys return a list of values, like "genres".
#genres = movie.get('genres')
#if genres:
# print 'Genres: %s' % ' '.join(genres)
#
# XXX: even when only one value is present (e.g.: movie with only one
# director), fields that can be multiple are ALWAYS a list.
# Note that the 'name' variable is a Person object, but since its
# __str__() method returns a string with the name, we can use it
# directly, instead of name['name']
#director = movie.get('director')
#if director:
# print 'Director(s): ',
# for name in director:
# sys.stdout.write('%s ' % name)
# print ''
#
# XXX: notice that every name in the cast is a Person object, with a
# currentRole instance variable, which is a string for the played role.
#cast = movie.get('cast')
#if cast:
# print 'Cast: '
# cast = cast[:5]
# for name in cast:
# print ' %s (%s)' % (name['name'], name.currentRole)
# XXX: some information are not lists of strings or Person objects, but simple
# strings, like 'rating'.
#rating = movie.get('rating')
#if rating:
# print 'Rating: %s' % rating
# XXX: an example of how to use information sets; retrieve the "trivia"
# info set; check if it contains some data, select and print a
# random entry.
#import random
#i.update(movie, info=['trivia'])
#trivia = movie.get('trivia')
#if trivia:
# rand_trivia = trivia[random.randrange(len(trivia))]
# print 'Random trivia: %s' % rand_trivia
#!/usr/bin/env python
"""
get_person.py
Usage: get_person "personID"
Show some info about the person with the given imdbID (e.g. '0000210'
for "Julia Roberts".
"""
# Parameters to initialize the IMDb class.
IMDB_PARAMS = {
# The used access system. 'web' means that you're retrieving data
# from the IMDb web server.
'accessSystem': 'web'
#'accessSystem': 'mobile'
# XXX: if you've a local installation of the IMDb database,
# comment the above line and uncomment the following two.
#'accessSystem': 'local',
#'dbDirectory': '/usr/local/imdb' # or, in a Windows environment:
#'dbDirectory': 'D:/imdb-20060107'
# XXX: parameters for a SQL installation.
#'accessSystem': 'sql',
#'uri': 'mysql://userName:yourPassword@localhost/dbName'
}
import sys
# Import the IMDbPY package.
try:
import imdb
except ImportError:
print 'You bad boy! You need to install the IMDbPY package!'
sys.exit(1)
if len(sys.argv) != 2:
print 'Only one argument is required:'
print ' %s "imdbID"' % sys.argv[0]
sys.exit(2)
imdbID = sys.argv[1]
i = imdb.IMDb(**IMDB_PARAMS)
out_encoding = sys.stdout.encoding or sys.getdefaultencoding()
try:
# Get a Person object with the data about the person identified by
# the given imdbID.
person = i.get_person(imdbID)
except imdb.IMDbError, e:
print "Probably you're not connected to Internet. Complete error report:"
print e
sys.exit(3)
if not person:
print 'It seems that there\'s no person with imdbID "%s"' % imdbID
sys.exit(4)
# XXX: this is the easier way to print the main info about a person;
# calling the summary() method of a Person object will returns a string
# with the main information about the person.
# Obviously it's not really meaningful if you want to know how
# to access the data stored in a Person object, so look below; the
# commented lines show some ways to retrieve information from a
# Person object.
print person.summary().encode(out_encoding, 'replace')
# Show some info about the person.
# This is only a short example; you can get a longer summary using
# 'print person.summary()' and the complete set of information looking for
# the output of the person.keys() method.
#print '==== "%s" / imdbID: %s ====' % (person['name'], imdbID)
# XXX: use the IMDb instance to get the IMDb web URL for the person.
#imdbURL = i.get_imdbURL(person)
#if imdbURL:
# print 'IMDb URL: %s' % imdbURL
# XXX: print the birth date and birth notes.
#d_date = person.get('birth date')
#if d_date:
# print 'Birth date: %s' % d_date
# b_notes = person.get('birth notes')
# if b_notes:
# print 'Birth notes: %s' % b_notes
# XXX: print the last five movies he/she acted in, and the played role.
#movies_acted = person.get('actor') or person.get('actress')
#if movies_acted:
# print 'Last roles played: '
# for movie in movies_acted[:5]:
# print ' %s (in "%s")' % (movie.currentRole, movie['title'])
# XXX: example of the use of information sets.
#import random
#i.update(person, info=['awards'])
#awards = person.get('awards')
#if awards:
# rand_award = awards[random.randrange(len(awards))]
# s = 'Random award: in year '
# s += rand_award.get('year', '')
# s += ' %s "%s"' % (rand_award.get('result', '').lower(),
# rand_award.get('award', ''))
# print s
This diff is collapsed.
#!/usr/bin/env python
"""
search_movie.py
Usage: search_movie "movie title"
Search for the given title and print the results.
"""
# Parameters to initialize the IMDb class.
IMDB_PARAMS = {
# The used access system. 'web' means that you're retrieving data
# from the IMDb web server.
'accessSystem': 'web'
#'accessSystem': 'mobile'
# XXX: if you've a local installation of the IMDb database,
# comment the above line and uncomment the following two.
#'accessSystem': 'local',
#'dbDirectory': '/usr/local/imdb' # or, in a Windows environment:
#'dbDirectory': 'D:/imdb-20060107'
# XXX: parameters for a SQL installation.
#'accessSystem': 'sql',
#'uri': 'mysql://userName:yourPassword@localhost/dbName'
}
import sys
# Import the IMDbPY package.
try:
import imdb
except ImportError:
print 'You bad boy! You need to install the IMDbPY package!'
sys.exit(1)
if len(sys.argv) != 2:
print 'Only one argument is required:'
print ' %s "movie title"' % sys.argv[0]
sys.exit(2)
title = sys.argv[1]
i = imdb.IMDb(**IMDB_PARAMS)
in_encoding = sys.stdin.encoding or sys.getdefaultencoding()
out_encoding = sys.stdout.encoding or sys.getdefaultencoding()
title = unicode(title, in_encoding, 'replace')
try:
# Do the search, and get the results (a list of Movie objects).
results = i.search_movie(title)
except imdb.IMDbError, e:
print "Probably you're not connected to Internet. Complete error report:"
print e
sys.exit(3)
# Print the results.
print ' %s results for "%s":' % (len(results),
title.encode(out_encoding, 'replace'))
# Print the long imdb title for every movie.
for movie in results:
print '%s: %s' % (i.get_imdbMovieID(movie.movieID),
movie['long imdb title'].encode(out_encoding, 'replace'))
#!/usr/bin/env python
"""
search_person.py
Usage: search_person "person name"
Search for the given name and print the results.
"""
# Parameters to initialize the IMDb class.
IMDB_PARAMS = {
# The used access system. 'web' means that you're retrieving data
# from the IMDb web server.
'accessSystem': 'web'
#'accessSystem': 'mobile'
# XXX: if you've a local installation of the IMDb database,
# comment the above line and uncomment the following two.
#'accessSystem': 'local',
#'dbDirectory': '/usr/local/imdb' # or, in a Windows environment:
#'dbDirectory': 'D:/imdb-20060107'
# XXX: parameters for a SQL installation.
#'accessSystem': 'sql',
#'uri': 'mysql://userName:yourPassword@localhost/dbName'
}
import sys
# Import the IMDbPY package.
try:
import imdb
except ImportError:
print 'You bad boy! You need to install the IMDbPY package!'
sys.exit(1)
if len(sys.argv) != 2:
print 'Only one argument is required:'
print ' %s "person name"' % sys.argv[0]
sys.exit(2)
name = sys.argv[1]
i = imdb.IMDb(**IMDB_PARAMS)
in_encoding = sys.stdin.encoding or sys.getdefaultencoding()
out_encoding = sys.stdout.encoding or sys.getdefaultencoding()
name = unicode(name, in_encoding, 'replace')
try:
# Do the search, and get the results (a list of Person objects).
results = i.search_person(name)
except imdb.IMDbError, e:
print "Probably you're not connected to Internet. Complete error report:"
print e
sys.exit(3)
# Print the results.
print ' %s results for "%s":' % (len(results),
name.encode(out_encoding, 'replace'))
# Print the long imdb name for every person.
for person in results:
print '%s: %s' % (i.get_imdbPersonID(person.personID),
person['long imdb name'].encode(out_encoding, 'replace'))
NOTE: see also CONTRIBUTORS.txt for a list of developers of important
portions of the code and CREDITS.txt for a list of people who
contributed with hints, patches and so on.
AUTHOR: Davide Alberani
e-mail: da@erlug.linux.it or alberanid@libero.it
IMDbPY page: http://imdbpy.sf.net/
my homepage: http://erlug.linux.it/~da/ (Italian)
my cine-blog: http://cinemelma.blogspot.com/ (Italian)
Jabber ID: alberanid@jabber.linux.it (I'm on-line only from time to time)
ICQ UIN: 83641305 (nick 'Mad77') (I'm on-line only from time to time)
PGP KeyID: 0x465BFD47 (the key is available in my homepage and
through every keyserver)
Sometimes (very seldom) you can find me in IRC on channels #python,
#linux-it and so on over irc.freenode.net with the nick 'Mad77'.
Feel free to contact me for any ideas, bug reports and everything else. :-)
People who contributed with a substantial amount of work and that
share the copyright over some portions of the code:
NAME: Giuseppe "Cowo" Corbelli
EMAIL: <cowo --> lugbs.linux.it>
DESCRIPTION: provided a lot of code and hints to integrate IMDbPY
with SQLObject, working on the imdbpy2sql.py script and the dbschema.py
module.
See also CONTRIBUTORS.txt for a list of the most important developers.
I'd like to thank the following people for their help:
* Tero Saarni, for the series 60 GUI and a lot of testing and
debugging.
* Ana Guerrero, for the official debian package.
* Martin Arpon and Andreas Schoenle for bug reports (and patches)
about "runtime", "aka titles" and "production notes" information
not being parsed.
* none none (dclist at gmail.com) for a useful hint and code to
retrieve a movie/person object, given an URL.
* Sebastian Pölsterl, for a bug report about the cover url for
tv (mini) series.
* Julian Mayer, for a bug report and a patch about non-ascii chars.
* Wim Schut and "eccentric", for bug reports and a patches about
movies' cover url.
* Alfio Ferrara, for a bug report about the get_first_movie.py script.
* Magnus Lie Hetland for an hint about the searches in sql package.
* Thomas Jadjewski for a bug report about the imdbpy2sql.py script.
* Trevor MacPhail, for a bug report about search_* methods and
the ParserBase.parse method.
* Sebastian Pölsterl, for a bug report about search_* methods.
* Guillaume Wisniewski, for a bug report.
* Kent Johnson, for a bug report.
* Andras Bali, for the hint about the "plot outline" information.
* Nick S. Novikov, who provided the Windows installer until I've
managed to set up a Windows development environment.
* Simone Bacciglieri, who downloaded the plain text data files for me.
* Carmine Noviello, for some design hints.
* "Basilius" for a bug report.
* Davide for a bug report.
This diff is collapsed.
DISCLAIMER
==========
IMDbPY (and the author) is not affiliated with Internet Movie Database Inc.
IMDb is a trademark of Internet Movie Database Inc. and all contents
and data included on the IMDb's site is the property of IMDb or its
content suppliers and protected by United States and international
copyright laws.
Please, read the IMDb's conditions of use in their website:
- http://www.imdb.com/help/show_article?conditions
- http://www.imdb.com/help/show_leaf?usedatasoftware
- any other notice in the http://www.imdb.com/ site.
This diff is collapsed.
INSTALLATION
============
See the "README.txt" file.
You've to read it anyway, isn't it? <g>
IMDbPY
NOTE: see also the recommendations in the "DISCLAIMER.txt" file.
Copyright 2004-2006 Davide Alberani <da@erlug.linux.it>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
IMDbPY for (too) sensitive people
=================================
Since version 2.0 (shame on me! I've noticed this only after more
than a year of development!!!) by default adult movies are included
in the result of the search_movie() and search_person() methods.
If for some unintelligible reason you don't want classics
like "Debbie Does Dallas" to show up in your list of results,
you can disable this feature initializing the IMDb class with
the 'adultSearch' argument set to 0 (or other "False" value).
E.g.:
from imdb import IMDb
ia = IMDb(accessSystem='http', adultSearch=0)
The behavior of a IMDb class's instance can be modified at
runtime, calling the do_adult_search() method.
E.g.:
from imdb import IMDb
# By default in the horny-mode.
ia = IMDb(accessSystem='http')
# Just for this example, be sure to exclude the proxy.
ia.set_proxy(None)
results = ia.search_movie('debby does dallas', results=5)
for movie in results:
print movie['long imdb title'], movie.movieID
# It will print:
# Debbie Does Dallas (1978) 0077415
# Debbie Does Dallas Part II (1981) 0083807
# Debbie Does Dallas: The Next Generation (1997) (V) 0160174
# Debbie Does Dallas '99 (1999) (V) 0233539
# Debbie Does Dallas 3 (1985) 0124352
# You can now revert to the old puritan behavior.
ia.do_adult_search(0)
results = ia.search_movie('debby does dallas', results=5)
for movie in results:
print movie['long imdb title'], movie.movieID
# It will print only:
# Pauly Does Dallas (1993) (TV) 0208347
The do_adult_search() method of the http and mobile data access system
also takes another couple of arguments: "cookie_id" and "cookie_uu", so
that you can select _your own_ IMDb's account.
For the strings to use, see your "cookie" or "cookie.txt" file.
Obviously you need to activate the "adult movies" option for
your account; see http://imdb.com/find/preferences?_adult=1
OTHER DATA ACCESS SYSTEMS
=========================
Since version 2.2 every other data access system (local and sql)
support the same behavior of the http and mobile data access
systems (i.e.: you can set the 'adultSearch' argument and use
the 'do_adult_search' method).