From d38d4ffc6fc7e7a979f145ea28e012d45341b918 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 13 Jul 2008 15:31:16 +0200 Subject: [PATCH] only use season episode if its in the right place --- oxweb/imdb.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/oxweb/imdb.py b/oxweb/imdb.py index 08a315b..16fc977 100644 --- a/oxweb/imdb.py +++ b/oxweb/imdb.py @@ -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, '([\d\.]*?)/10') @@ -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]