[cineoob] [imdb] fillobj ok for person and movie
[piratebay] get_torrent return None if 404
This commit is contained in:
parent
0587f9ecdd
commit
b9d3719ad2
3 changed files with 26 additions and 23 deletions
|
|
@ -75,7 +75,16 @@ class ImdbBackend(BaseBackend, ICapCinema):
|
||||||
or 'short_biography' in fields or 'roles' in fields\
|
or 'short_biography' in fields or 'roles' in fields\
|
||||||
or 'birth_date' in fields\
|
or 'birth_date' in fields\
|
||||||
or 'gender' in fields or fields == None:
|
or 'gender' in fields or fields == None:
|
||||||
return self.get_person(person.id)
|
per = self.get_person(person.id)
|
||||||
|
person.real_name = per.real_name
|
||||||
|
person.birth_date = per.birth_date
|
||||||
|
person.death_date = per.death_date
|
||||||
|
person.birth_place = per.birth_place
|
||||||
|
person.gender = per.gender
|
||||||
|
person.nationality = per.nationality
|
||||||
|
person.short_biography = per.short_biography
|
||||||
|
person.short_description = per.short_description
|
||||||
|
person.roles = per.roles
|
||||||
|
|
||||||
if 'biography' in fields:
|
if 'biography' in fields:
|
||||||
person.biography = self.get_person_biography(person.id)
|
person.biography = self.get_person_biography(person.id)
|
||||||
|
|
@ -85,9 +94,16 @@ class ImdbBackend(BaseBackend, ICapCinema):
|
||||||
def fill_movie(self, movie, fields):
|
def fill_movie(self, movie, fields):
|
||||||
if 'other_titles' in fields or 'release_date' in fields\
|
if 'other_titles' in fields or 'release_date' in fields\
|
||||||
or 'duration' in fields or 'country' in fields\
|
or 'duration' in fields or 'country' in fields\
|
||||||
or 'roles' in fields or 'note' in fields\
|
or 'roles' in fields or 'note' in fields:
|
||||||
or fields == None:
|
mov = self.get_movie(movie.id)
|
||||||
return self.get_movie(movie.id)
|
movie.other_titles = mov.other_titles
|
||||||
|
movie.release_date = mov.release_date
|
||||||
|
movie.duration = mov.duration
|
||||||
|
movie.pitch = mov.pitch
|
||||||
|
movie.country = mov.country
|
||||||
|
movie.note = mov.note
|
||||||
|
movie.roles = mov.roles
|
||||||
|
movie.short_description= mov.short_description
|
||||||
return movie
|
return movie
|
||||||
|
|
||||||
OBJECTS = {
|
OBJECTS = {
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,9 @@ class PiratebayBrowser(BaseBrowser):
|
||||||
return self.page.iter_torrents()
|
return self.page.iter_torrents()
|
||||||
|
|
||||||
def get_torrent(self, id):
|
def get_torrent(self, id):
|
||||||
self.location('https://thepiratebay.se/torrent/%s/' % id)
|
try:
|
||||||
|
self.location('https://thepiratebay.se/torrent/%s/' % id)
|
||||||
|
except:
|
||||||
|
return None
|
||||||
assert self.is_on_page(TorrentPage)
|
assert self.is_on_page(TorrentPage)
|
||||||
return self.page.get_torrent(id)
|
return self.page.get_torrent(id)
|
||||||
|
|
|
||||||
|
|
@ -291,15 +291,7 @@ class Cineoob(ReplApplication):
|
||||||
|
|
||||||
Get information about a movie.
|
Get information about a movie.
|
||||||
"""
|
"""
|
||||||
# TODO understand core to get a call to Backend.fill_movie when get_object is called
|
movie = self.get_object(id, 'get_movie',('duration','release_date'))
|
||||||
# then the following paragraph can be replace by the following commented line
|
|
||||||
#movie = self.get_object(id, 'get_movie',['duration'])
|
|
||||||
movie = None
|
|
||||||
_id, backend = self.parse_id(id)
|
|
||||||
for _backend, result in self.do('get_movie', _id, backends=backend, caps=ICapCinema):
|
|
||||||
if result:
|
|
||||||
backend = _backend
|
|
||||||
movie = result
|
|
||||||
|
|
||||||
if not movie:
|
if not movie:
|
||||||
print >>sys.stderr, 'Movie not found: %s' % id
|
print >>sys.stderr, 'Movie not found: %s' % id
|
||||||
|
|
@ -317,14 +309,7 @@ class Cineoob(ReplApplication):
|
||||||
|
|
||||||
Get information about a person.
|
Get information about a person.
|
||||||
"""
|
"""
|
||||||
# TODO understand core to get a call to Backend.fill_person when get_object is called
|
person = self.get_object(id, 'get_person',('birth_date','birth_place'))
|
||||||
#person = self.get_object(id, 'get_person')
|
|
||||||
person = None
|
|
||||||
_id, backend = self.parse_id(id)
|
|
||||||
for _backend, result in self.do('get_person', _id, backends=backend, caps=ICapCinema):
|
|
||||||
if result:
|
|
||||||
backend = _backend
|
|
||||||
person = result
|
|
||||||
|
|
||||||
if not person:
|
if not person:
|
||||||
print >>sys.stderr, 'Person not found: %s' % id
|
print >>sys.stderr, 'Person not found: %s' % id
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue