Subdivx Provider: improve language parser

pull/1831/head
Vitiko 3 years ago
parent 79f81e0edb
commit 7423c80a28

@ -216,13 +216,14 @@ class SubdivxSubtitlesProvider(Provider):
if not any(item in datos for item in ("Cds:</b> 1", "SubRip")):
continue
spain = "/pais/7.gif" in datos
language = Language.fromalpha2("es") if spain else Language("spa", "MX")
# description
sub_details = body_soup.find("div", {"id": "buscador_detalle_sub"}).text
description = sub_details.replace(",", " ")
# language
spain = "/pais/7.gif" in datos or "españa" in description.lower()
language = Language.fromalpha2("es") if spain else Language("spa", "MX")
# uploader
uploader = body_soup.find("a", {"class": "link1"}).text
download_url = _get_download_url(body_soup)

@ -126,6 +126,15 @@ def episodes():
resolution="720p",
video_codec="H.264",
),
"better_call_saul_s06e04": Episode(
"Better.Call.Saul.S06E04.720p.WEBRIP.X264.mkv",
"Better Call Saul",
6,
4,
source="Web",
resolution="720p",
video_codec="H.264",
),
"inexistent": Episode(
"Inexistent.TVShow.S01E01.720p.BluRay.X264-REWARD.mkv",
"121361asdfgh",

@ -27,6 +27,12 @@ def test_list_subtitles_episode(episodes, episode_key, expected):
assert len(subtitles) >= expected
def test_list_subtitles_castillian_spanish(episodes):
item = episodes["better_call_saul_s06e04"]
with SubdivxSubtitlesProvider() as provider:
assert provider.list_subtitles(item, {Language.fromietf("es")})
def test_download_subtitle(movies):
subtitle = SubdivxSubtitle(
Language("spa", "MX"),

Loading…
Cancel
Save