support new series format in parse_movie_path

This commit is contained in:
j 2012-08-22 00:53:08 +02:00
parent b728fdc9b7
commit ebf3b691b2

View file

@ -374,32 +374,45 @@ def parse_movie_path(path):
language = ''
#season/episode/episodeTitle
season = find_re(parts[-1], '\.Season (\d+)\.')
if season:
season = int(season)
else:
season = None
episode = find_re(parts[-1], '\.Episode[s]* ([\d+]+)\.')
if episode:
episode = episode.split('+')[0]
episode = int(episode)
else:
episode = None
if episode and 'Episode %d'%episode in fileparts:
episodeTitle = fileparts.index('Episode %d' % episode) + 1
episodeTitle = fileparts[episodeTitle]
if episodeTitle == extension or episodeTitle.startswith('Part'):
episodeTitle = None
if not season and 'Episode' in fileparts:
episodeTitle = fileparts.index('Episode') + 1
episodeTitle = fileparts[episodeTitle]
if episodeTitle == extension or episodeTitle.startswith('Part'):
episodeTitle = None
else:
match = re.compile('(.+?) \((S(\d+))?(E(\d+))?\)( (.+?))?\.').match(parts[-1])
if match:
seriesTitle = match.group(1)
season = match.group(3)
episode = match.group(5)
episodeTitle = (match.group(6) or '').strip()
if episode != None:
episode = int(episode)
if season != None:
season = int(season)
if episode and not season:
season = 1
else:
season = find_re(parts[-1], '\.Season (\d+)\.')
if season:
season = int(season)
else:
season = None
episode = find_re(parts[-1], '\.Episode[s]* ([\d+]+)\.')
if episode:
episode = episode.split('+')[0]
episode = int(episode)
else:
episode = None
if episode and 'Episode %d'%episode in fileparts:
episodeTitle = fileparts.index('Episode %d' % episode) + 1
episodeTitle = fileparts[episodeTitle]
if episodeTitle == extension or episodeTitle.startswith('Part'):
episodeTitle = None
if not season and 'Episode' in fileparts:
episodeTitle = fileparts.index('Episode') + 1
episodeTitle = fileparts[episodeTitle]
if episodeTitle == extension or episodeTitle.startswith('Part'):
episodeTitle = None
else:
season = 1
if season:
seriesTitle = title