[cineoob] get_object cleaning
This commit is contained in:
parent
b9d3719ad2
commit
c3c0561887
4 changed files with 18 additions and 28 deletions
|
|
@ -104,6 +104,10 @@ class ImdbBackend(BaseBackend, ICapCinema):
|
|||
movie.note = mov.note
|
||||
movie.roles = mov.roles
|
||||
movie.short_description= mov.short_description
|
||||
|
||||
if 'all_release_dates' in fields:
|
||||
movie.all_release_dates = self.get_movie_releases(movie.id)
|
||||
|
||||
return movie
|
||||
|
||||
OBJECTS = {
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ class ImdbBrowser(BaseBrowser):
|
|||
movie.country = NotLoaded
|
||||
movie.note = NotLoaded
|
||||
movie.roles = NotLoaded
|
||||
movie.all_release_dates= NotLoaded
|
||||
yield movie
|
||||
|
||||
def iter_persons(self, pattern):
|
||||
|
|
@ -149,6 +150,7 @@ class ImdbBrowser(BaseBrowser):
|
|||
movie.note = note
|
||||
movie.roles = roles
|
||||
movie.short_description= short_description
|
||||
movie.all_release_dates= NotLoaded
|
||||
return movie
|
||||
|
||||
def get_person(self, id):
|
||||
|
|
|
|||
|
|
@ -41,12 +41,17 @@ class ReleasePage(BasePage):
|
|||
country = a.text
|
||||
td_date = self.parser.select(a.getparent().getparent().getparent(),'td')[1]
|
||||
date_links = self.parser.select(td_date,'a')
|
||||
date = date_links[1].attrib.get('href','').strip('/').split('/')[-1]
|
||||
date += '-'+date_links[0].attrib.get('href','').strip('/').split('/')[-1]
|
||||
if len(date_links) > 1:
|
||||
date = date_links[1].attrib.get('href','').strip('/').split('/')[-1]
|
||||
date += '-'+date_links[0].attrib.get('href','').strip('/').split('/')[-1]
|
||||
else:
|
||||
date = unicode(self.parser.select(a.getparent().getparent().getparent(),'td')[1].text_content())
|
||||
result += '%s : %s\n' % (country,date)
|
||||
if result == u'':
|
||||
result = NotAvailable
|
||||
return result.strip()
|
||||
else:
|
||||
result = result.strip()
|
||||
return result
|
||||
|
||||
|
||||
class BiographyPage(BasePage):
|
||||
|
|
|
|||
|
|
@ -391,21 +391,11 @@ class Cineoob(ReplApplication):
|
|||
|
||||
Show the complete biography of a person.
|
||||
"""
|
||||
# TODO understand how to handle short id trying to be get by wrong backends and validate this line !
|
||||
# in other words, find a way to select CAP when 'get_object' to avoid useless errors and clarify the following code
|
||||
#person = self.get_object(person_id,'get_person',('name','biography'))
|
||||
|
||||
person = None
|
||||
_id, backend = self.parse_id(person_id)
|
||||
for _backend, result in self.do('get_person', _id, backends=backend, caps=ICapCinema):
|
||||
if result:
|
||||
backend = _backend
|
||||
person = result
|
||||
person = self.get_object(person_id,'get_person',('name','biography'))
|
||||
if not person:
|
||||
print >>sys.stderr, 'Person not found: %s' % _id
|
||||
print >>sys.stderr, 'Person not found: %s' % person_id
|
||||
return 3
|
||||
|
||||
backend.fillobj(person,('biography'))
|
||||
self.start_format()
|
||||
self.format(person)
|
||||
self.flush()
|
||||
|
|
@ -424,13 +414,7 @@ class Cineoob(ReplApplication):
|
|||
"""
|
||||
id, country = self.parse_command_args(line, 2, 1)
|
||||
|
||||
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
|
||||
|
||||
movie = self.get_object(id,'get_movie',('original_title'))
|
||||
if not movie:
|
||||
print >>sys.stderr, 'Movie not found: %s' % id
|
||||
return 3
|
||||
|
|
@ -538,12 +522,7 @@ class Cineoob(ReplApplication):
|
|||
|
||||
Search torrents of movie_ID.
|
||||
"""
|
||||
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
|
||||
movie = self.get_object(id, 'get_movie', ('original_title'))
|
||||
if not movie:
|
||||
print >>sys.stderr, 'Movie not found: %s' % id
|
||||
return 3
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue