mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-27 21:54:17 +01:00
subtitle: a way to download only subtitle.
This commit is contained in:
parent
d970f9b05c
commit
5e1e6dbbc9
@ -53,6 +53,7 @@ class Options:
|
|||||||
self.password = None
|
self.password = None
|
||||||
self.thumbnail = False
|
self.thumbnail = False
|
||||||
self.all_episodes = False
|
self.all_episodes = False
|
||||||
|
self.force_subtitle = False
|
||||||
|
|
||||||
def get_media(url, options):
|
def get_media(url, options):
|
||||||
|
|
||||||
@ -162,6 +163,8 @@ def main():
|
|||||||
parser.add_option("-S", "--subtitle",
|
parser.add_option("-S", "--subtitle",
|
||||||
action="store_true", dest="subtitle", default=False,
|
action="store_true", dest="subtitle", default=False,
|
||||||
help="Download subtitle from the site if available.")
|
help="Download subtitle from the site if available.")
|
||||||
|
parser.add_option("--force-subtitle", dest="force_subtitle", default=False,
|
||||||
|
action="store_true", help="Download only subtitle if its used with -S")
|
||||||
parser.add_option("-u", "--username", default=None,
|
parser.add_option("-u", "--username", default=None,
|
||||||
help="Username")
|
help="Username")
|
||||||
parser.add_option("-p", "--password", default=None,
|
parser.add_option("-p", "--password", default=None,
|
||||||
|
@ -60,6 +60,10 @@ class Kanal5(Service):
|
|||||||
options.live = data["isLive"]
|
options.live = data["isLive"]
|
||||||
if data["hasSubtitle"]:
|
if data["hasSubtitle"]:
|
||||||
self.subtitle = "http://www.kanal5play.se/api/subtitles/%s" % video_id
|
self.subtitle = "http://www.kanal5play.se/api/subtitles/%s" % video_id
|
||||||
|
|
||||||
|
if options.subtitle and options.force_subtitle:
|
||||||
|
return
|
||||||
|
|
||||||
if options.hls:
|
if options.hls:
|
||||||
url = data["streams"][0]["source"]
|
url = data["streams"][0]["source"]
|
||||||
if data["streams"][0]["drmProtected"]:
|
if data["streams"][0]["drmProtected"]:
|
||||||
|
@ -87,6 +87,9 @@ class Svtplay(Service, OpenGraphThumbMixin):
|
|||||||
else:
|
else:
|
||||||
test = select_quality(options, streams)
|
test = select_quality(options, streams)
|
||||||
|
|
||||||
|
if options.subtitle and options.force_subtitle:
|
||||||
|
return
|
||||||
|
|
||||||
parse = urlparse(test["url"])
|
parse = urlparse(test["url"])
|
||||||
if parse.scheme == "rtmp":
|
if parse.scheme == "rtmp":
|
||||||
embedurl = "%s?type=embed" % url
|
embedurl = "%s?type=embed" % url
|
||||||
|
@ -75,6 +75,9 @@ class Tv4play(Service, OpenGraphThumbMixin):
|
|||||||
swf = "http://www.tv4play.se/flash/tv4playflashlets.swf"
|
swf = "http://www.tv4play.se/flash/tv4playflashlets.swf"
|
||||||
options.other = "-W %s -y %s" % (swf, test["path"])
|
options.other = "-W %s -y %s" % (swf, test["path"])
|
||||||
|
|
||||||
|
if options.subtitle and options.force_subtitle:
|
||||||
|
return
|
||||||
|
|
||||||
if test["uri"][0:4] == "rtmp":
|
if test["uri"][0:4] == "rtmp":
|
||||||
download_rtmp(options, test["uri"])
|
download_rtmp(options, test["uri"])
|
||||||
elif test["uri"][len(test["uri"])-3:len(test["uri"])] == "f4m":
|
elif test["uri"][len(test["uri"])-3:len(test["uri"])] == "f4m":
|
||||||
|
@ -59,6 +59,10 @@ class Urplay(Service, OpenGraphThumbMixin):
|
|||||||
sys.exit(4)
|
sys.exit(4)
|
||||||
|
|
||||||
options.other = "-v -a %s -y %s" % (jsondata["streaming_config"]["rtmp"]["application"], selected["rtmp"]["path"])
|
options.other = "-v -a %s -y %s" % (jsondata["streaming_config"]["rtmp"]["application"], selected["rtmp"]["path"])
|
||||||
|
|
||||||
|
if options.subtitle and options.force_subtitle:
|
||||||
|
return
|
||||||
|
|
||||||
if options.hls:
|
if options.hls:
|
||||||
download_hls(options, selected["hls"]["playlist"])
|
download_hls(options, selected["hls"]["playlist"])
|
||||||
else:
|
else:
|
||||||
|
@ -83,6 +83,9 @@ class Viaplay(Service, OpenGraphThumbMixin):
|
|||||||
filename = "%s://%s:%s%s" % (parse.scheme, parse.hostname, parse.port, match.group(1))
|
filename = "%s://%s:%s%s" % (parse.scheme, parse.hostname, parse.port, match.group(1))
|
||||||
path = "-y %s" % match.group(2)
|
path = "-y %s" % match.group(2)
|
||||||
options.other = "-W http://flvplayer.viastream.viasat.tv/flvplayer/play/swf/player.swf %s" % path
|
options.other = "-W http://flvplayer.viastream.viasat.tv/flvplayer/play/swf/player.swf %s" % path
|
||||||
|
if options.subtitle and options.force_subtitle:
|
||||||
|
return
|
||||||
|
|
||||||
download_rtmp(options, filename)
|
download_rtmp(options, filename)
|
||||||
|
|
||||||
def get_subtitle(self, options):
|
def get_subtitle(self, options):
|
||||||
|
Loading…
Reference in New Issue
Block a user