[imdb] tests ok, unicode ok
This commit is contained in:
parent
84ea3ad59b
commit
1262744aa6
3 changed files with 11 additions and 11 deletions
|
|
@ -51,10 +51,10 @@ class ImdbBackend(BaseBackend, ICapCinema):
|
|||
def iter_persons(self, pattern):
|
||||
return self.browser.iter_persons(quote_plus(pattern.encode('utf-8')))
|
||||
|
||||
def iter_movie_persons(self, id, role):
|
||||
def iter_movie_persons(self, id, role=None):
|
||||
return self.browser.iter_movie_persons(id, role)
|
||||
|
||||
def iter_person_movies(self, id, role):
|
||||
def iter_person_movies(self, id, role=None):
|
||||
return self.browser.iter_person_movies(id, role)
|
||||
|
||||
def iter_person_movies_ids(self, id):
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class ImdbBrowser(BaseBrowser):
|
|||
other_titles = []
|
||||
roles = {}
|
||||
|
||||
title = jres['title']
|
||||
title = u'%s'%jres['title'].strip()
|
||||
if jres.has_key('runtime'):
|
||||
dur_str = jres['runtime'][0].split(':')
|
||||
if len(dur_str) == 1:
|
||||
|
|
@ -101,19 +101,19 @@ class ImdbBrowser(BaseBrowser):
|
|||
day = 1
|
||||
release_date = datetime(year,month,day)
|
||||
if jres.has_key('country'):
|
||||
country = ''
|
||||
country = u''
|
||||
for c in jres['country']:
|
||||
country += '%s, '%c
|
||||
country = country[:-2]
|
||||
if jres.has_key('plot_simple'):
|
||||
description = jres['plot_simple']
|
||||
description = u'%s'%jres['plot_simple']
|
||||
if jres.has_key('rating') and jres.has_key('rating_count'):
|
||||
note = "%s/10 (%s votes)"%(jres['rating'],jres['rating_count'])
|
||||
note = u'%s/10 (%s votes)'%(jres['rating'],jres['rating_count'])
|
||||
for r in ['actor','director','writer']:
|
||||
if jres.has_key('%ss'%r):
|
||||
roles['%s'%r] = list(jres['%ss'%r])
|
||||
|
||||
movie = Movie(id,title.strip())
|
||||
movie = Movie(id,title)
|
||||
movie.other_titles = other_titles
|
||||
movie.release_date = release_date
|
||||
movie.duration = duration
|
||||
|
|
|
|||
|
|
@ -110,19 +110,19 @@ class PersonPage(BasePage):
|
|||
td_overview = self.parser.select(self.document.getroot(),'td#overview-top',1)
|
||||
descs = self.parser.select(td_overview,'span[itemprop=description]')
|
||||
if len(descs) > 0:
|
||||
short_biography = descs[0].text
|
||||
short_biography = u'%s'%descs[0].text
|
||||
rname_block = self.parser.select(td_overview,'div.txt-block h4.inline')
|
||||
if len(rname_block) > 0 and "born" in rname_block[0].text.lower():
|
||||
links = self.parser.select(rname_block[0].getparent(),'a')
|
||||
for a in links:
|
||||
href = a.attrib.get('href','').strip()
|
||||
if href == 'bio':
|
||||
real_name = a.text.strip()
|
||||
real_name = u'%s'%a.text.strip()
|
||||
elif 'birth_place' in href:
|
||||
birth_place = a.text.lower().strip()
|
||||
birth_place = u'%s'%a.text.lower().strip()
|
||||
names = self.parser.select(td_overview,'h1[itemprop=name]')
|
||||
if len(names) > 0:
|
||||
name = names[0].text.strip()
|
||||
name = u'%s'%names[0].text.strip()
|
||||
times = self.parser.select(td_overview,'time[itemprop=birthDate]')
|
||||
if len(times) > 0:
|
||||
time = times[0].attrib.get('datetime','').split('-')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue