diff --git a/libs/fese/stream.py b/libs/fese/stream.py index 3c73b1d3c..1039cdd8b 100755 --- a/libs/fese/stream.py +++ b/libs/fese/stream.py @@ -20,7 +20,7 @@ class FFprobeSubtitleStream: :raises: LanguageNotFound, UnsupportedCodec """ self.index = int(stream["index"]) - self.codec_name = stream["codec_name"] + self.codec_name = stream.get("codec_name", "Unknown") try: self._codec = _codecs[self.codec_name] 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 diff --git a/tests/subliminal_patch/conftest.py b/tests/subliminal_patch/conftest.py index d60a807aa..7f72a4814 100644 --- a/tests/subliminal_patch/conftest.py +++ b/tests/subliminal_patch/conftest.py @@ -6,6 +6,7 @@ import os import pytest from subliminal_patch.core import Movie, Episode +from subzero.language import Language logging.getLogger("vcr").setLevel(logging.WARNING) @@ -148,6 +149,11 @@ def episodes(): } +@pytest.fixture +def languages(): + return {"en": Language.fromietf("en"), "es-MX": Language("spa", "MX")} + + @pytest.fixture def data(): return os.path.join(os.path.abspath(os.path.dirname(__file__)), "data")