From a82ab6769d9f508151c1cc438a6ab637d65bd7e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Bart=C3=ADk?= <63553146+sambartik@users.noreply.github.com> Date: Sun, 9 Oct 2022 15:17:16 +0200 Subject: [PATCH] Fix titulky's subtitle downloading logic --- libs/subliminal_patch/providers/titulky.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/subliminal_patch/providers/titulky.py b/libs/subliminal_patch/providers/titulky.py index aedbe7906..9fdc1661c 100644 --- a/libs/subliminal_patch/providers/titulky.py +++ b/libs/subliminal_patch/providers/titulky.py @@ -452,7 +452,11 @@ class TitulkyProvider(Provider, ProviderSubtitleArchiveMixin): else: subtitle_content = fix_line_ending(res.content) - if not subtitle_content: + if archive and len(archive.infolist()) > 1 and not subtitle_content: + logger.info(f"Titulky.com: Couldn't find a proper subtitle file in the downloaded archive.") + elif archive and len(archive.infolist()) == 1 and not subtitle_content: raise DownloadLimitExceeded("Subtitles download limit has been exceeded") + elif not subtitle_content: + raise ProviderError("No subtitles provided from titulky") subtitle.content = subtitle_content