Hey,
my code is:
from imdb import IMDb
def getPersons(personname):
print "fetching movies for person '" + personname + "'"
ia = IMDb()
s_result = ia.search_person(personname)
if (len(s_result) == 0):
print "got no person for '" + personname + "'"
return false
res = s_result[0]
print res.get('music')
ia.update(res)
movies = s_result[0].get('movies')
ret = {}
for movie in movies:
ret[str(movie.getID())] = str(movie)
print "got " + str(len(movie)) + " movies"
return ret
def intersect(a, b):
return list(set(a) & set(b))
def comparePersons(personNames):
moviePersons = {}
for personName in personNames:
moviePersons[personName] = getPersons(personName)
i = 0
for k in moviePersons.keys():
i += 1
for k2 in moviePersons.keys()[i:]:
actors = intersect(moviePersons[k], moviePersons[k2])
print "comparing '" + k + "' to '" + k2 + "' => got " +
str(len(actors)) + " hit(s)"
for movie in movies:
print moviePersons[k][movie]
comparePersons(['Tanya Wexler', 'Stephen Dyer'])
and I get back :
fetching movies for person 'Tanya Wexler'
None
Traceback (most recent call last):
File "film2.py", line 43, in <module>
comparePersons(['Tanya Wexler', 'Stephen
File "film2.py", line 33, in comparePersons
moviePersons[personName] = getPersons(per
File "film2.py", line 22, in getPersons
for movie in movies:
TypeError: 'NoneType' object is not iterable
I dont really know if I got the right commands. What I wanna do is to
compare people´s´filmography to know if they had worked together before.
Tanks
domi
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Imdbpy-help mailing list
Imdbpy-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-help