1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 04:05:39 +01:00

dplay: support for other languages in subtitles

fixes: #410
This commit is contained in:
Johan Andersson 2016-06-28 21:40:35 +02:00
parent e5a646843c
commit 421f53f099

View File

@ -68,7 +68,8 @@ class Dplay(Service):
yield ServiceError("Excluding video")
return
suburl = dataj["data"][0]["subtitles_sv_srt"]
subt = "subtitles_%s_srt" % self._country2lang()
suburl = dataj["data"][0][subt]
if len(suburl) > 0:
yield subtitle(copy.copy(self.options), "raw", suburl)
@ -120,6 +121,15 @@ class Dplay(Service):
else:
return False
def _country2lang(self):
parse = urlparse(self.url)
domain = re.search(r"dplay\.(\w\w)", parse.netloc).group(1)
country = {"se": "sv", "no": "no", "dk": "da"}
if domain and domain in country:
return country[domain]
else:
return "sv"
def _playable(self, dataj, premium):
if dataj["data"][0]["content_info"]["package_label"]["value"] == "Premium" and not premium:
return 1