Merge remote-tracking branch 'origin/development' into development

This commit is contained in:
morpheus65535 2022-10-09 21:54:32 -04:00
commit 8a5e05b86a
3 changed files with 12 additions and 2 deletions

View file

@ -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]

View file

@ -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

View file

@ -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")