revert changes
This commit is contained in:
parent
e04cc5b819
commit
7ebfdaff30
1 changed files with 40 additions and 25 deletions
65
ox/movie.py
65
ox/movie.py
|
@ -39,6 +39,7 @@ def format_path(data, has_director_directory=True):
|
||||||
director = data['seriesDirectorSort' if data['isEpisode'] else 'directorSort'] or ['Unknown Director']
|
director = data['seriesDirectorSort' if data['isEpisode'] else 'directorSort'] or ['Unknown Director']
|
||||||
title = data['seriesTitle' if data['isEpisode'] else 'title'] or 'Untitled'
|
title = data['seriesTitle' if data['isEpisode'] else 'title'] or 'Untitled'
|
||||||
year = data['seriesYear' if data['isEpisode'] else 'year']
|
year = data['seriesYear' if data['isEpisode'] else 'year']
|
||||||
|
language = 'en' if data['type'] == 'subtitle' and data['language'] == None else data['language']
|
||||||
parts = map(format_underscores, filter(lambda x: x != None, [
|
parts = map(format_underscores, filter(lambda x: x != None, [
|
||||||
data['directory'] or director[0][0] if has_director_directory else title[0],
|
data['directory'] or director[0][0] if has_director_directory else title[0],
|
||||||
'; '.join(director) if has_director_directory else None,
|
'; '.join(director) if has_director_directory else None,
|
||||||
|
@ -57,6 +58,7 @@ def format_path(data, has_director_directory=True):
|
||||||
return '/'.join(parts)
|
return '/'.join(parts)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def parse_item_files(files):
|
def parse_item_files(files):
|
||||||
# parses a list of file objects associated with one item (file objects
|
# parses a list of file objects associated with one item (file objects
|
||||||
# as returned by parse_path, but extended with 'path' and 'time')
|
# as returned by parse_path, but extended with 'path' and 'time')
|
||||||
|
@ -372,32 +374,45 @@ def parse_movie_path(path):
|
||||||
language = ''
|
language = ''
|
||||||
|
|
||||||
#season/episode/episodeTitle
|
#season/episode/episodeTitle
|
||||||
season = find_re(parts[-1], '\.Season (\d+)\.')
|
match = re.compile('(.+?) \((S(\d+))?(E(\d+))?\)( (.+?))?\.').match(parts[-1])
|
||||||
if season:
|
if match:
|
||||||
season = int(season)
|
seriesTitle = match.group(1)
|
||||||
else:
|
season = match.group(3)
|
||||||
season = None
|
episode = match.group(5)
|
||||||
|
episodeTitle = (match.group(6) or '').strip()
|
||||||
episode = find_re(parts[-1], '\.Episode[s]* ([\d+]+)\.')
|
if episode != None:
|
||||||
if episode:
|
episode = int(episode)
|
||||||
episode = episode.split('+')[0]
|
if season != None:
|
||||||
episode = int(episode)
|
season = int(season)
|
||||||
else:
|
if episode and not season:
|
||||||
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
|
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:
|
if season:
|
||||||
seriesTitle = title
|
seriesTitle = title
|
||||||
|
|
Loading…
Reference in a new issue