diff --git a/ox/web/imdb.py b/ox/web/imdb.py index ac12c83..316b926 100644 --- a/ox/web/imdb.py +++ b/ox/web/imdb.py @@ -158,15 +158,6 @@ class Imdb(SiteParser): 'type': 'list' }, 'country': zebra_list('Country', more=['(.*?)']), - 'creator': { - 'page': '', - 're': [ - '
.*?Creator.?:(.*?)
', - ' 10: - series['creator'] = series['director'][:1] - - for key in ['creator', 'country']: - if key in series: - self[key] = series[key] - - if 'year' in series: - self['seriesYear'] = series['year'] - if 'year' not in self: - self['year'] = series['year'] - - if 'year' in self: - self['episodeYear'] = self['year'] - if 'creator' in self: - self['seriesDirector'] = self['creator'] - if 'originalTitle' in self: - del self['originalTitle'] - else: - for key in ('seriesTitle', 'episodeTitle', 'season', 'episode'): - if key in self: - del self[key] - if 'creator' in self: - if 'director' in self: - self['episodeDirector'] = self['director'] - self['director'] = self['creator'] #make lists unique but keep order for key in ('director', 'language'): @@ -581,6 +531,57 @@ class Imdb(SiteParser): series_credit = [c for c in self['credits'] if c.get('deparment') == deparment] if series_credit: self[key] = [c['name'] for c in series_credit] + creator = [] + for c in self.get('credits', []): + if '(created by)' in c['roles'] and c['name'] not in creator: + creator.append(c['name']) + if creator: + self['creator'] = creator + + if 'series' in self: + series = Imdb(self['series'], timeout=timeout) + self['seriesTitle'] = series['title'] + if 'episodeTitle' in self: + self['seriesTitle'] = series['title'] + if 'season' in self and 'episode' in self: + self['title'] = "%s (S%02dE%02d) %s" % ( + self['seriesTitle'], self['season'], self['episode'], self['episodeTitle']) + else: + self['title'] = "%s (S01) %s" % (self['seriesTitle'], self['episodeTitle']) + self['season'] = 1 + self['title'] = self['title'].strip() + if 'director' in self: + self['episodeDirector'] = self['director'] + + if 'creator' not in series and 'director' in series: + series['creator'] = series['director'] + if len(series['creator']) > 10: + series['creator'] = series['director'][:1] + + for key in ['creator', 'country']: + if key in series: + self[key] = series[key] + + if 'year' in series: + self['seriesYear'] = series['year'] + if 'year' not in self: + self['year'] = series['year'] + + if 'year' in self: + self['episodeYear'] = self['year'] + if 'creator' in self: + self['seriesDirector'] = self['creator'] + if 'originalTitle' in self: + del self['originalTitle'] + else: + for key in ('seriesTitle', 'episodeTitle', 'season', 'episode'): + if key in self: + del self[key] + if 'creator' in self: + if 'director' in self: + self['episodeDirector'] = self['director'] + self['director'] = self['creator'] + class ImdbCombined(Imdb): def __init__(self, id, timeout=-1):