1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 21:54:17 +01:00

dplay: support for subtitles

This commit is contained in:
Johan Andersson 2015-10-30 00:54:18 +01:00
parent e1cb21c20a
commit 409310252d

View File

@ -10,6 +10,7 @@ import os
from svtplay_dl.service import Service
from svtplay_dl.fetcher.hds import hdsparse
from svtplay_dl.fetcher.hls import hlsparse
from svtplay_dl.subtitle import subtitle
from svtplay_dl.utils.urllib import quote
from svtplay_dl.error import ServiceError
from svtplay_dl.utils import filenamify
@ -59,6 +60,13 @@ class Dplay(Service):
options.output = os.path.join(directory, title)
else:
options.output = title
suburl = dataj["data"][0]["subtitles_sv_srt"]
if len(suburl) > 0:
yield subtitle(copy.copy(options), "raw", suburl)
if options.force_subtitle:
return
data = self.http.request("get", "http://geo.dplay.se/geo.js").text
dataj = json.loads(data)
geo = dataj["countryCode"]