mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-27 21:54:17 +01:00
parent
d20fa3d959
commit
da66ffcf2e
@ -77,10 +77,10 @@ class postprocess(object):
|
||||
subfix = subfix.strip('-')
|
||||
langs += [exceptions[subfix]]
|
||||
continue
|
||||
subfile = "{}.srt".format(os.path.splitext(self.stream.options.output)[0] + subfix)
|
||||
subfile = "{0}.srt".format(os.path.splitext(self.stream.options.output)[0] + subfix)
|
||||
langs += [query(subfile)]
|
||||
else:
|
||||
subfile = "{}.srt".format(os.path.splitext(self.stream.options.output)[0])
|
||||
subfile = "{0}.srt".format(os.path.splitext(self.stream.options.output)[0])
|
||||
langs += [query(subfile)]
|
||||
if len(langs) >= 2:
|
||||
log.info("Language codes: " + ', '.join(langs))
|
||||
@ -97,14 +97,14 @@ class postprocess(object):
|
||||
if self.stream.options.output.endswith('.mp4') is False:
|
||||
orig_filename = self.stream.options.output
|
||||
name, ext = os.path.splitext(orig_filename)
|
||||
new_name = u"{}.mp4".format(name)
|
||||
new_name = u"{0}.mp4".format(name)
|
||||
|
||||
if self.merge_subtitle:
|
||||
log.info(u"Muxing %s and merging its subtitle into %s", orig_filename, new_name)
|
||||
else:
|
||||
log.info(u"Muxing %s into %s".format(orig_filename, new_name))
|
||||
|
||||
tempfile = u"{}.temp".format(orig_filename)
|
||||
tempfile = u"{0}.temp".format(orig_filename)
|
||||
arguments = ["-map", "0:v", "-map", "0:a", "-c", "copy", "-copyts", "-f", "mp4"]
|
||||
if ext == ".ts":
|
||||
arguments += ["-bsf:a", "aac_adtstoasc"]
|
||||
@ -116,10 +116,10 @@ class postprocess(object):
|
||||
arguments += ["-map", str(stream_num + 1), "-c:s:" + str(stream_num), "mov_text", "-metadata:s:s:" + str(stream_num), "language=" + language]
|
||||
if len(self.subfixes) >= 2:
|
||||
for subfix in self.subfixes:
|
||||
subfile = "{}.srt".format(name + subfix)
|
||||
subfile = "{0}.srt".format(name + subfix)
|
||||
cmd += ["-i", subfile]
|
||||
else:
|
||||
subfile = "{}.srt".format(name)
|
||||
subfile = "{0}.srt".format(name)
|
||||
cmd += ["-i", subfile]
|
||||
|
||||
arguments += ["-y", tempfile]
|
||||
@ -136,7 +136,7 @@ class postprocess(object):
|
||||
log.info("Muxing done, removing the old files.")
|
||||
if len(self.subfixes) >= 2:
|
||||
for subfix in self.subfixes:
|
||||
subfile = "{}.srt".format(name + subfix)
|
||||
subfile = "{0}.srt".format(name + subfix)
|
||||
os.remove(subfile)
|
||||
else: os.remove(subfile)
|
||||
else: log.info("Muxing done, removing the old file.")
|
||||
@ -156,9 +156,9 @@ class postprocess(object):
|
||||
else:
|
||||
log.info("Merge audio and video into %s", orig_filename)
|
||||
|
||||
tempfile = u"{}.temp".format(orig_filename)
|
||||
tempfile = u"{0}.temp".format(orig_filename)
|
||||
name = os.path.splitext(orig_filename)[0]
|
||||
audio_filename = u"{}.m4a".format(name)
|
||||
audio_filename = u"{0}.m4a".format(name)
|
||||
arguments = ["-c:v", "copy", "-c:a", "copy", "-f", "mp4"]
|
||||
cmd = [self.detect, "-i", orig_filename, "-i", audio_filename]
|
||||
|
||||
@ -168,10 +168,10 @@ class postprocess(object):
|
||||
arguments += ["-map", "0", "-map", "1", "-map", str(stream_num), "-c:s:" + str(stream_num - 2), "mov_text", "-metadata:s:s:" + str(stream_num - 2), "language=" + language]
|
||||
if len(self.subfixes) >= 2:
|
||||
for subfix in self.subfixes:
|
||||
subfile = "{}.srt".format(name + subfix)
|
||||
subfile = "{0}.srt".format(name + subfix)
|
||||
cmd += ["-i", subfile]
|
||||
else:
|
||||
subfile = "{}.srt".format(name)
|
||||
subfile = "{0}.srt".format(name)
|
||||
cmd += ["-i", subfile]
|
||||
|
||||
arguments += ["-y", tempfile]
|
||||
@ -190,7 +190,7 @@ class postprocess(object):
|
||||
if self.merge_subtitle and not self.external_subtitle:
|
||||
if len(self.subfixes) >= 2:
|
||||
for subfix in self.subfixes:
|
||||
subfile = "{}.srt".format(name + subfix)
|
||||
subfile = "{0}.srt".format(name + subfix)
|
||||
os.remove(subfile)
|
||||
else: os.remove(subfile)
|
||||
os.rename(tempfile, orig_filename)
|
||||
|
@ -32,7 +32,7 @@ class Aftonbladet(Service):
|
||||
vendor = janson["playerOptions"]["vendor"]
|
||||
self.options.live = janson["live"]
|
||||
if not self.options.live:
|
||||
dataurl = "{}{}/assets/{}?appName=svp-player".format(apiurl, vendor, videoId)
|
||||
dataurl = "{0}{1}/assets/{2}?appName=svp-player".format(apiurl, vendor, videoId)
|
||||
data = self.http.request("get", dataurl).text
|
||||
data = json.loads(data)
|
||||
|
||||
|
@ -111,7 +111,7 @@ class Dplay(Service):
|
||||
else:
|
||||
show = filenamify(show)
|
||||
title = filenamify(title)
|
||||
return filenamify("{}.s{:02d}e{:02d}.{}".format(show, int(season), int(episode), title))
|
||||
return filenamify("{0}.s{1:02d}e{2:02d}.{3}".format(show, int(season), int(episode), title))
|
||||
|
||||
def _login(self, options):
|
||||
parse = urlparse(self.url)
|
||||
|
@ -27,7 +27,7 @@ class Sr(Service, OpenGraphThumbMixin):
|
||||
|
||||
match = re.search('data-audio-type="publication" data-audio-id="(\d+)">', data) # Nyheter
|
||||
if match:
|
||||
dataurl = "https://sverigesradio.se/sida/playerajax/getaudiourl?id={}&type={}&quality=high&format=iis".format(match.group(1), "publication")
|
||||
dataurl = "https://sverigesradio.se/sida/playerajax/getaudiourl?id={0}&type={1}&quality=high&format=iis".format(match.group(1), "publication")
|
||||
data = self.http.request("get", dataurl).text
|
||||
playerinfo = json.loads(data)
|
||||
yield HTTP(copy.copy(self.options), playerinfo["audioUrl"], 128)
|
||||
@ -49,7 +49,7 @@ class Sr(Service, OpenGraphThumbMixin):
|
||||
yield ServiceError("Can't find audio info")
|
||||
return
|
||||
|
||||
dataurl = "https://sverigesradio.se/sida/playerajax/getaudiourl?id={}&type={}&quality=high&format=iis".format(aid, type)
|
||||
dataurl = "https://sverigesradio.se/sida/playerajax/getaudiourl?id={0}&type={1}&quality=high&format=iis".format(aid, type)
|
||||
data = self.http.request("get", dataurl).text
|
||||
playerinfo = json.loads(data)
|
||||
yield HTTP(copy.copy(self.options), playerinfo["audioUrl"], 128)
|
||||
|
@ -50,7 +50,7 @@ class Svtplay(Service, OpenGraphThumbMixin):
|
||||
vid = janson["video"]["programVersionId"]
|
||||
else:
|
||||
vid = janson["video"]["id"]
|
||||
res = self.http.get("http://api.svt.se/videoplayer-api/video/{}".format(vid))
|
||||
res = self.http.get("http://api.svt.se/videoplayer-api/video/{0}".format(vid))
|
||||
janson = res.json()
|
||||
|
||||
if "subtitleReferences" in janson:
|
||||
|
@ -252,10 +252,10 @@ class Viaplay(Service, OpenGraphThumbMixin):
|
||||
|
||||
name = filenamify(program)
|
||||
if season:
|
||||
name = "{}.s{:02d}".format(name, int(season))
|
||||
name = "{0}.s{1:02d}".format(name, int(season))
|
||||
if episode:
|
||||
name = "{}e{:02d}".format(name, int(episode))
|
||||
name = "{0}e{1:02d}".format(name, int(episode))
|
||||
if title:
|
||||
name = "{}.{}".format(name, title)
|
||||
name = "{0}.{1}".format(name, title)
|
||||
|
||||
return name
|
Loading…
Reference in New Issue
Block a user