From 7d5fdafe0ca5e064edac5c9dde6da295f3c4e95f Mon Sep 17 00:00:00 2001 From: German Gutierrez Date: Sat, 18 Jan 2020 14:20:53 +0100 Subject: [PATCH] LegendasDivxs: skipping .txt files from archived file --- libs/subliminal_patch/providers/legendasdivx.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/subliminal_patch/providers/legendasdivx.py b/libs/subliminal_patch/providers/legendasdivx.py index ae40ed482..5537e5828 100644 --- a/libs/subliminal_patch/providers/legendasdivx.py +++ b/libs/subliminal_patch/providers/legendasdivx.py @@ -287,15 +287,21 @@ class LegendasdivxProvider(Provider): return archive def _get_subtitle_from_archive(self, archive): + # some files have a non subtitle with .txt extension + _tmp = list(SUBTITLE_EXTENSIONS) + _tmp.remove('.txt') + _subtitle_extensions = tuple(_tmp) + for name in archive.namelist(): # discard hidden files if os.path.split(name)[-1].startswith('.'): continue # discard non-subtitle files - if not name.lower().endswith(SUBTITLE_EXTENSIONS): + if not name.lower().endswith(_subtitle_extensions): continue + logger.debug("returning from archive: %s" % name) return archive.read(name) raise ParseResponseError('Can not find the subtitle in the compressed file')