From e1508f406840cd43cad1a2238761a2de54405176 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 31 May 2013 13:06:42 +0000 Subject: [PATCH] add movie.normalize_paths and call in parse_item_files --- ox/movie.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ox/movie.py b/ox/movie.py index 392f25c..ae69976 100644 --- a/ox/movie.py +++ b/ox/movie.py @@ -165,8 +165,16 @@ def parse_item_files(files): 'subtitleLanguage': language[version_key] if version_key in language else None, 'version': version_key }) + data = normalize_paths(data) return data +def normalize_paths(versions): + for version in versions: + for extension in EXTENSIONS['subtitle']: + files = [file for file in version['files'] if file['extension'] == extension] + if len(files) == 1 and files[0]['language'] == LANGUAGES[0]: + files[0]['normalizedPath'] = format_path(dict(files[0], **{'language': None})) + return versions def parse_path(path, directory_key='director'): '''