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

View file

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