episodes without director where series does not have a creator, fix euro entity

This commit is contained in:
j 2011-10-18 14:25:13 +02:00
parent 2057e699bd
commit f1fee46126
2 changed files with 9 additions and 1 deletions

View file

@ -137,6 +137,8 @@ def decodeHtml(html):
""" """
>>> decodeHtml('me & you and $&%') >>> decodeHtml('me & you and $&%')
u'me & you and $&%' u'me & you and $&%'
>>> decodeHtml('€')
u''
""" """
if type(html) != unicode: if type(html) != unicode:
html = unicode(html)[:] html = unicode(html)[:]
@ -146,7 +148,9 @@ def decodeHtml(html):
uchr = lambda value: value > 255 and unichr(value) or chr(value) uchr = lambda value: value > 255 and unichr(value) or chr(value)
def entitydecode(match, uchr=uchr): def entitydecode(match, uchr=uchr):
entity = match.group(1) entity = match.group(1)
if entity.startswith('#x'): if entity == '#x80':
return u''
elif entity.startswith('#x'):
return uchr(int(entity[2:], 16)) return uchr(int(entity[2:], 16))
elif entity.startswith('#'): elif entity.startswith('#'):
return uchr(int(entity[1:])) return uchr(int(entity[1:]))

View file

@ -356,6 +356,10 @@ class Imdb(SiteParser):
for key in ['creator', 'year', 'country']: for key in ['creator', 'year', 'country']:
if key in series: if key in series:
self[key] = series[key] self[key] = series[key]
if not 'director' in self and 'director' in series:
self['director'] = series['director']
if 'originalTitle' in self: if 'originalTitle' in self:
del self['originalTitle'] del self['originalTitle']
else: else: