[cineoob] give roles informations in persons_in_common and movies_in_common, imdb and allocine adapted
This commit is contained in:
parent
372da14347
commit
f87a8a685f
5 changed files with 49 additions and 7 deletions
|
|
@ -46,6 +46,18 @@ class Movie(BaseObject):
|
|||
BaseObject.__init__(self, id)
|
||||
self.original_title = original_title
|
||||
|
||||
def get_role_by_person_name(self,name):
|
||||
for role in self.roles.keys():
|
||||
if name.lower() in [person[1].lower() for person in self.roles[role]]:
|
||||
return role
|
||||
return None
|
||||
|
||||
def get_role_by_person_id(self,id):
|
||||
for role in self.roles.keys():
|
||||
if id in [person[0] for person in self.roles[role]]:
|
||||
return role
|
||||
return None
|
||||
|
||||
|
||||
class Person(BaseObject):
|
||||
"""
|
||||
|
|
@ -68,6 +80,20 @@ class Person(BaseObject):
|
|||
BaseObject.__init__(self, id)
|
||||
self.name = name
|
||||
|
||||
def get_role_by_movie_title(self,title):
|
||||
for role in self.roles.keys():
|
||||
for mt in [movie[1] for movie in self.roles[role]]:
|
||||
# title we have is included ?
|
||||
if title.lower() in mt.lower():
|
||||
return role
|
||||
return None
|
||||
|
||||
def get_role_by_movie_id(self,id):
|
||||
for role in self.roles.keys():
|
||||
if id in [movie[0] for movie in self.roles[role]]:
|
||||
return role
|
||||
return None
|
||||
|
||||
|
||||
class CapCinema(Capability):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue