From c33edd3ff3de3c00da26380ad22d3d65318027e8 Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 31 May 2013 15:52:09 +0200 Subject: [PATCH] fix '.en' stripping (movies can have parts, do don't check for '1 srt is en', but 'all srts are en') --- ox/movie.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ox/movie.py b/ox/movie.py index 533503b..024a06c 100644 --- a/ox/movie.py +++ b/ox/movie.py @@ -156,9 +156,11 @@ def parse_item_files(files): # remove unneeded '.en' for version_key in version_files: for extension in EXTENSIONS['subtitle']: - files = [file for file in version_files[version_key] if file['extension'] == extension] - if len(files) == 1 and files[0]['language'] == LANGUAGES[0]: - files[0]['normalizedPath'] = format_path(dict(files[0], **{'language': None})) + subtitle_files = [file for file in version_files[version_key] if file['extension'] == extension] + subtitle_languages = set([file['language'] for file in subtitle_files]) + if len(languages) == 1 and languages[0] == LANGUAGES[0]: + for subtitle_file in subtitle_files: + subtitle_file['normalizedPath'] = format_path(dict(subtitle_file, **{'language': None})) # return data data = [] for version_key in version_files: