LegendasDivxs: skipping .txt files from archived file

pull/756/head
German Gutierrez 5 years ago
parent 6291cf7134
commit 7d5fdafe0c

@ -287,15 +287,21 @@ class LegendasdivxProvider(Provider):
return archive return archive
def _get_subtitle_from_archive(self, 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(): for name in archive.namelist():
# discard hidden files # discard hidden files
if os.path.split(name)[-1].startswith('.'): if os.path.split(name)[-1].startswith('.'):
continue continue
# discard non-subtitle files # discard non-subtitle files
if not name.lower().endswith(SUBTITLE_EXTENSIONS): if not name.lower().endswith(_subtitle_extensions):
continue continue
logger.debug("returning from archive: %s" % name)
return archive.read(name) return archive.read(name)
raise ParseResponseError('Can not find the subtitle in the compressed file') raise ParseResponseError('Can not find the subtitle in the compressed file')

Loading…
Cancel
Save