delete unsupported subtitle archive files from cache

pull/1038/head
josdion 5 years ago
parent 3e4a75aeca
commit 8acb488fba

@ -255,4 +255,5 @@ class SubsSabBzProvider(Provider):
return self.process_archive_subtitle_files(ZipFile(archive_stream), language, video, link, fps, num_cds) return self.process_archive_subtitle_files(ZipFile(archive_stream), language, video, link, fps, num_cds)
else: else:
logger.error('Ignore unsupported archive %r', request.headers) logger.error('Ignore unsupported archive %r', request.headers)
region.delete(cache_key)
return [] return []

@ -277,4 +277,5 @@ class SubsUnacsProvider(Provider):
return self.process_archive_subtitle_files(SevenZipFile(archive_stream), language, video, link, fps, num_cds) return self.process_archive_subtitle_files(SevenZipFile(archive_stream), language, video, link, fps, num_cds)
else: else:
logger.error('Ignore unsupported archive %r', request.headers) logger.error('Ignore unsupported archive %r', request.headers)
region.delete(cache_key)
return [] return []

@ -25,13 +25,13 @@ from .utils import FIRST_THOUSAND_OR_SO_USER_AGENTS as AGENT_LIST
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class YavkaNetSubtitle(Subtitle): class YavkaNetSubtitle(Subtitle):
"""YavkaNet Subtitle.""" """YavkaNet Subtitle."""
provider_name = 'yavkanet' provider_name = 'yavkanet'
def __init__(self, langauge, filename, type, video, link, fps): def __init__(self, language, filename, type, video, link, fps):
super(YavkaNetSubtitle, self).__init__(langauge) super(YavkaNetSubtitle, self).__init__(language)
self.langauge = langauge
self.filename = filename self.filename = filename
self.page_link = link self.page_link = link
self.type = type self.type = type
@ -66,7 +66,7 @@ class YavkaNetSubtitle(Subtitle):
if ((video_filename == subtitle_filename) or if ((video_filename == subtitle_filename) or
(self.single_file is True and video_filename in self.notes.upper())): (self.single_file is True and video_filename in self.notes.upper())):
matches.add('hash') matches.add('hash')
if video.year and self.year == video.year: if video.year and self.year == video.year:
matches.add('year') matches.add('year')
@ -212,4 +212,5 @@ class YavkaNetProvider(Provider):
return self.process_archive_subtitle_files(ZipFile(archive_stream), language, video, link, fps) return self.process_archive_subtitle_files(ZipFile(archive_stream), language, video, link, fps)
else: else:
logger.error('Ignore unsupported archive %r', request.headers) logger.error('Ignore unsupported archive %r', request.headers)
region.delete(cache_key)
return [] return []

@ -178,6 +178,7 @@ class YifySubtitlesProvider(Provider):
self._process_archive(ZipFile(archive_stream), subtitle) self._process_archive(ZipFile(archive_stream), subtitle)
else: else:
logger.error('Ignore unsupported archive %r', request.headers) logger.error('Ignore unsupported archive %r', request.headers)
region.delete(cache_key)
def _process_archive(self, archive_stream, subtitle): def _process_archive(self, archive_stream, subtitle):
for file_name in archive_stream.namelist(): for file_name in archive_stream.namelist():

Loading…
Cancel
Save