1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-23 11:45:38 +01:00

Compare commits

...

4 Commits

Author SHA1 Message Date
I'm an OSK user, are you?
9dfbbdb061
Merge c81de1f693 into 85d93464e2 2024-10-06 19:46:01 +02:00
Carl Christerson
85d93464e2 Avoid overwrite config for merge subtitle 2024-10-06 19:45:26 +02:00
Patrik Lermon
515ab99c7a tv4play: update Client-Version from 4.0.0 to 5.2.0 2024-10-05 23:18:58 +02:00
I'm an OSK user, are you?
c81de1f693
Update README.md
Replaced dplay.se with discoveryplus.com
Removed comedycentral.se (it will redirect to paramount.com)
Removed kanal9play.se (site is dead)
2023-10-16 16:11:15 +02:00
5 changed files with 13 additions and 15 deletions

View File

@ -115,15 +115,13 @@ This script works for:
- aftonbladet.se - aftonbladet.se
- bambuser.com - bambuser.com
- comedycentral.se
- di.se - di.se
- discoveryplus.com
- dn.se - dn.se
- dplay.se
- dr.dk - dr.dk
- efn.se - efn.se
- expressen.se - expressen.se
- hbo.com - hbo.com
- kanal9play.se
- nickelodeon.nl - nickelodeon.nl
- nickelodeon.no - nickelodeon.no
- nickelodeon.se - nickelodeon.se
@ -143,7 +141,6 @@ This script works for:
- ur.se - ur.se
- urplay.se - urplay.se
- vg.no - vg.no
- viagame.com
## License ## License

View File

@ -31,7 +31,7 @@ class postprocess:
if os.path.isfile(path): if os.path.isfile(path):
self.detect = path self.detect = path
def merge(self): def merge(self, merge_subtitle):
if self.detect is None: if self.detect is None:
logging.error("Cant detect ffmpeg or avconv. Cant mux files without it.") logging.error("Cant detect ffmpeg or avconv. Cant mux files without it.")
return return
@ -60,7 +60,7 @@ class postprocess:
streams = _streams(stderr) streams = _streams(stderr)
videotrack, audiotrack = _checktracks(streams) videotrack, audiotrack = _checktracks(streams)
if self.config.get("merge_subtitle"): if merge_subtitle:
logging.info("Merge audio, video and subtitle into %s", new_name.name) logging.info("Merge audio, video and subtitle into %s", new_name.name)
else: else:
logging.info(f"Merge audio and video into {str(new_name.name).replace('.audio', '')}") logging.info(f"Merge audio and video into {str(new_name.name).replace('.audio', '')}")
@ -89,7 +89,7 @@ class postprocess:
arguments += ["-map", f"{videotrack}"] arguments += ["-map", f"{videotrack}"]
if audiotrack: if audiotrack:
arguments += ["-map", f"{audiotrack}"] arguments += ["-map", f"{audiotrack}"]
if self.config.get("merge_subtitle"): if merge_subtitle:
langs = _sublanguage(self.stream, self.config, self.subfixes) langs = _sublanguage(self.stream, self.config, self.subfixes)
tracks = [x for x in [videotrack, audiotrack] if x] tracks = [x for x in [videotrack, audiotrack] if x]
subs_nr = 0 subs_nr = 0
@ -135,7 +135,7 @@ class postprocess:
os.remove(audio_filename) os.remove(audio_filename)
# This if statement is for use cases where both -S and -M are specified to not only merge the subtitle but also store it separately. # This if statement is for use cases where both -S and -M are specified to not only merge the subtitle but also store it separately.
if self.config.get("merge_subtitle") and not self.config.get("subtitle"): if merge_subtitle and not self.config.get("subtitle"):
if self.subfixes and len(self.subfixes) >= 2 and self.config.get("get_all_subtitles"): if self.subfixes and len(self.subfixes) >= 2 and self.config.get("get_all_subtitles"):
for subfix in self.subfixes: for subfix in self.subfixes:
subfile = orig_filename.parent / (orig_filename.stem + "." + subfix + ".srt") subfile = orig_filename.parent / (orig_filename.stem + "." + subfix + ".srt")

View File

@ -198,7 +198,7 @@ class Tv4play(Service, OpenGraphThumbMixin):
res = self.http.request( res = self.http.request(
"post", "post",
"https://client-gateway.tv4.a2d.tv/graphql", "https://client-gateway.tv4.a2d.tv/graphql",
headers={"Client-Name": "tv4-web", "Client-Version": "4.0.0", "Content-Type": "application/json", "Authorization": f"Bearer {token}"}, headers={"Client-Name": "tv4-web", "Client-Version": "5.2.0", "Content-Type": "application/json", "Authorization": f"Bearer {token}"},
json=data, json=data,
) )
janson = res.json() janson = res.json()
@ -242,7 +242,7 @@ class Tv4play(Service, OpenGraphThumbMixin):
res = self.http.request( res = self.http.request(
"post", "post",
"https://client-gateway.tv4.a2d.tv/graphql", "https://client-gateway.tv4.a2d.tv/graphql",
headers={"Client-Name": "tv4-web", "Client-Version": "4.0.0", "Content-Type": "application/json", "Authorization": f"Bearer {token}"}, headers={"Client-Name": "tv4-web", "Client-Version": "5.2.0", "Content-Type": "application/json", "Authorization": f"Bearer {token}"},
json=data, json=data,
) )
return res.json() return res.json()
@ -261,7 +261,7 @@ class Tv4play(Service, OpenGraphThumbMixin):
res = self.http.request( res = self.http.request(
"post", "post",
"https://client-gateway.tv4.a2d.tv/graphql", "https://client-gateway.tv4.a2d.tv/graphql",
headers={"Client-Name": "tv4-web", "Client-Version": "4.0.0", "Content-Type": "application/json"}, headers={"Client-Name": "tv4-web", "Client-Version": "5.2.0", "Content-Type": "application/json"},
json=data, json=data,
) )
janson = res.json() janson = res.json()

View File

@ -153,8 +153,9 @@ def get_one_media(stream):
logging.info("No subtitles available") logging.info("No subtitles available")
return return
merge_subtitle = False
if not stream.config.get("list_quality"): if not stream.config.get("list_quality"):
subtitle_decider(stream, subtitles) merge_subtitle = subtitle_decider(stream, subtitles)
if stream.config.get("force_subtitle"): if stream.config.get("force_subtitle"):
return return
@ -219,6 +220,6 @@ def get_one_media(stream):
if fstream.audio and not post.detect and fstream.finished: if fstream.audio and not post.detect and fstream.finished:
logging.warning("Can't find ffmpeg/avconv. audio and video is in seperate files. if you dont want this use -P hls or hds") logging.warning("Can't find ffmpeg/avconv. audio and video is in seperate files. if you dont want this use -P hls or hds")
if post.detect and fstream.config.get("no_merge") is False: if post.detect and fstream.config.get("no_merge") is False:
post.merge() post.merge(merge_subtitle)
else: else:
logging.info("All done. Not postprocessing files, leaving them completely untouched.") logging.info("All done. Not postprocessing files, leaving them completely untouched.")

View File

@ -119,8 +119,8 @@ def subtitle_decider(stream, subtitles):
print(subtitles[0].url) print(subtitles[0].url)
else: else:
subtitles[0].download() subtitles[0].download()
elif stream.config.get("merge_subtitle"): return stream.config.get("merge_subtitle")
stream.config.set("merge_subtitle", False) return False
def resolution(streams, resolutions: List) -> List: def resolution(streams, resolutions: List) -> List: