fix movies with only one alternative title

This commit is contained in:
j 2012-09-22 22:38:02 +02:00
parent ca9ffcf867
commit d29f9e3dc8

View file

@ -283,6 +283,11 @@ class Imdb(SiteParser):
time.sleep(1) time.sleep(1)
super(Imdb, self).__init__(0) super(Imdb, self).__init__(0)
if 'alternativeTitles' in self:
if len(self['alternativeTitles']) == 2 and \
isinstance(self['alternativeTitles'][0], basestring):
self['alternativeTitles'] = [self['alternativeTitles']]
for t in self.get('alternativeTitles', []): for t in self.get('alternativeTitles', []):
for type in t[1].split('/'): for type in t[1].split('/'):
type = type.strip() type = type.strip()
@ -317,9 +322,6 @@ class Imdb(SiteParser):
if t in self: if t in self:
self[t] = cleanup_title(self[t]) self[t] = cleanup_title(self[t])
if 'alternativeTitles' in self: if 'alternativeTitles' in self:
if len(self['alternativeTitles']) == 2 and \
isinstance(self['alternativeTitles'][0], basestring):
self['alternativeTitles'] = [self['alternativeTitles']]
alt = {} alt = {}
for t in self['alternativeTitles']: for t in self['alternativeTitles']:
title = cleanup_title(t[0]) title = cleanup_title(t[0])