Subdivx Provider: handle UnicodeEncodeError for some titles

This commit is contained in:
Vitiko 2023-04-14 23:19:12 -04:00
parent 695734abe6
commit da542a311a
2 changed files with 19 additions and 2 deletions

View File

@ -200,10 +200,9 @@ class SubdivxSubtitlesProvider(Provider):
# download the subtitle # download the subtitle
logger.debug("Downloading subtitle %r", subtitle) logger.debug("Downloading subtitle %r", subtitle)
# download zip / rar file with the subtitle
response = self.session.get( response = self.session.get(
subtitle.download_url, subtitle.download_url,
headers={"Referer": subtitle.page_link}, headers={"Referer": _SERVER_URL},
timeout=30, timeout=30,
) )
response.raise_for_status() response.raise_for_status()

View File

@ -153,3 +153,21 @@ def test_subtitle_matches(video):
assert "resolution" in matches assert "resolution" in matches
assert "video_codec" in matches assert "video_codec" in matches
assert "release_group" in matches assert "release_group" in matches
def test_latin_1_subtitles():
item = Episode.fromname(
"/tv/Grey's Anatomy/Season 19/Greys.Anatomy.S19E13.1080p.WEB.h264-ELEANOR[rarbg].mkv"
)
item.series = "Grey's Anatomy"
item.season = 19
item.episode = 13
with SubdivxSubtitlesProvider() as provider:
subtitles = provider.list_subtitles(item, {Language.fromietf("es")})
subtitle = subtitles[0]
provider.download_subtitle(subtitle)
assert subtitle.is_valid()