only use season episode if its in the right place

This commit is contained in:
j 2008-07-13 15:31:16 +02:00
parent 73ce77dc2e
commit d38d4ffc6f
1 changed files with 6 additions and 3 deletions

View File

@ -80,6 +80,7 @@ def getMovieInfo(imdbId):
elif ', ' in txt:
txt = [cleanUp(k) for k in txt.split(', ')]
if title == 'original air date':
info['series_episode_info'] = txt.split('\n')[-1].strip()
txt = txt.split('\n')[0].strip()
if not title.startswith('moviemeter'):
info[title] = txt
@ -119,6 +120,8 @@ def getMovieInfo(imdbId):
title = title[1:-1]
info['title'] = normalizeTitle(title)
info['year'] = year
#Series
if title.startswith('"') and title.find('"',1) > 0 and \
title.find('"',1) == title.rfind('"'):
episode_title = title[title.rfind('"')+1:]
@ -133,14 +136,14 @@ def getMovieInfo(imdbId):
else:
info['title'] = title
#Series
se = re.compile("Season (\d*), Episode (\d*)\)").findall(data)
se = re.compile("Season (\d*), Episode (\d*)\)").findall(info.get('series_episode_info', ''))
if se:
info['season'] = int(se[0][0])
info['episode'] = int(se[0][1])
info['title'] = "%s (S%02dE%02d) %s" % (
info['series title'], info['season'], info['episode'], info['episode title'])
info['title'] = info['title'].strip()
del info['series_episode_info']
#Rating
rating = findRe(data, '<b>([\d\.]*?)/10</b>')
@ -602,7 +605,7 @@ class IMDb:
self.IMDbDict = IMDbDict
if IMDbDict['episode_of']:
episode_of =IMDb(IMDbDict['episode_of']).parse()
episode_of =getMovieInfo(IMDbDict['episode_of'])
for key in ('country', 'language'):
if not IMDbDict[key]:
IMDbDict[key] = episode_of[key]