mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-23 11:45:38 +01:00
Black cosmetic fixes
This commit is contained in:
parent
9052eb3507
commit
15a64cf198
@ -86,7 +86,12 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=
|
||||
dispcmd = str([command] + args)
|
||||
# remember shell=False, so use git.cmd on windows, not just git
|
||||
process = subprocess.Popen(
|
||||
[command] + args, cwd=cwd, env=env, stdout=subprocess.PIPE, stderr=(subprocess.PIPE if hide_stderr else None), **popen_kwargs
|
||||
[command] + args,
|
||||
cwd=cwd,
|
||||
env=env,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=(subprocess.PIPE if hide_stderr else None),
|
||||
**popen_kwargs,
|
||||
)
|
||||
break
|
||||
except OSError:
|
||||
|
@ -392,7 +392,6 @@ class DASH(VideoRetriever):
|
||||
file_d.write(data.content)
|
||||
eta = ETA(total_size)
|
||||
while bytes_so_far < total_size:
|
||||
|
||||
if not self.config.get("silent"):
|
||||
eta.update(bytes_so_far)
|
||||
progressbar(total_size, bytes_so_far, "".join(["ETA: ", str(eta)]))
|
||||
|
@ -173,7 +173,12 @@ def _hlsparse(config, text, url, output, **kwargs):
|
||||
if subfix:
|
||||
subfix = f"{n[1]}-caption"
|
||||
yield from subtitle_probe(
|
||||
copy.copy(config), get_full_url(n[0], url), output=copy.copy(output), subfix=subfix, cookies=cookies, **kwargs
|
||||
copy.copy(config),
|
||||
get_full_url(n[0], url),
|
||||
output=copy.copy(output),
|
||||
subfix=subfix,
|
||||
cookies=cookies,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
elif m3u8.media_segment:
|
||||
|
@ -20,7 +20,6 @@ class M3U8:
|
||||
TAG_TYPES = {"MEDIA_SEGMENT": 0, "MEDIA_PLAYLIST": 1, "MASTER_PLAYLIST": 2}
|
||||
|
||||
def __init__(self, data):
|
||||
|
||||
self.version = None
|
||||
|
||||
self.media_segment = []
|
||||
@ -55,7 +54,6 @@ class M3U8:
|
||||
if not l:
|
||||
continue
|
||||
elif l.startswith("#EXT"):
|
||||
|
||||
info = {}
|
||||
tag, attr = _get_tag_attribute(l)
|
||||
if tag == "EXT-X-VERSION":
|
||||
@ -63,7 +61,6 @@ class M3U8:
|
||||
|
||||
# 4.3.2. Media Segment Tags
|
||||
elif tag in M3U8.MEDIA_SEGMENT_TAGS:
|
||||
|
||||
tag_type = M3U8.TAG_TYPES["MEDIA_SEGMENT"]
|
||||
# 4.3.2.1. EXTINF
|
||||
if tag == "EXTINF":
|
||||
@ -124,7 +121,6 @@ class M3U8:
|
||||
|
||||
# 4.3.3. Media Playlist Tags
|
||||
elif tag in M3U8.MEDIA_PLAYLIST_TAGS:
|
||||
|
||||
tag_type = M3U8.TAG_TYPES["MEDIA_PLAYLIST"]
|
||||
# 4.3.3.1. EXT-X-TARGETDURATION
|
||||
if tag == "EXT-X-TARGETDURATION":
|
||||
@ -154,7 +150,6 @@ class M3U8:
|
||||
|
||||
# 4.3.4. Master Playlist Tags
|
||||
elif tag in M3U8.MASTER_PLAYLIST_TAGS:
|
||||
|
||||
tag_type = M3U8.TAG_TYPES["MASTER_PLAYLIST"]
|
||||
# 4.3.4.1. EXT-X-MEDIA
|
||||
if tag == "EXT-X-MEDIA":
|
||||
@ -185,7 +180,6 @@ class M3U8:
|
||||
|
||||
# 4.3.5. Media or Master Playlist Tags
|
||||
elif tag in M3U8.MEDIA_OR_MASTER_PLAYLIST_TAGS:
|
||||
|
||||
tag_type = M3U8.TAG_TYPES["MEDIA_PLAYLIST"]
|
||||
# 4.3.5.1. EXT-X-INDEPENDENT-SEGMENTS
|
||||
if tag == "EXT-X-INDEPENDENT-SEGMENTS":
|
||||
|
@ -186,7 +186,8 @@ def _sublanguage(stream, config, subfixes):
|
||||
_ = parse(self)
|
||||
random_sentences = " ".join(sample(_, len(_) if len(_) < 8 else 8)).replace("\r\n", "")
|
||||
url = "https://svtplay-dl.se/langdetect/"
|
||||
headers = {"User-Agent": f"{FIREFOX_UA} {platform.machine()}"}
|
||||
bits = "64" if sys.maxsize > 2**32 else "32"
|
||||
headers = {"User-Agent": f"{FIREFOX_UA} {platform.machine()} {platform.platform()} {bits}"}
|
||||
try:
|
||||
r = post(url, json={"query": random_sentences}, headers=headers, timeout=30)
|
||||
if r.status_code == codes.ok:
|
||||
|
@ -56,7 +56,6 @@ class Mtvnn(Service, OpenGraphThumbMixin):
|
||||
and xml.find("./video").find("item").find("rendition") is not None
|
||||
and xml.find("./video").find("item").find("rendition").find("src") is not None
|
||||
):
|
||||
|
||||
hls_url = xml.find("./video").find("item").find("rendition").find("src").text
|
||||
stream = hlsparse(self.config, self.http.request("get", hls_url), hls_url, output=self.output)
|
||||
for key in list(stream.keys()):
|
||||
@ -144,6 +143,5 @@ class MtvMusic(Service, OpenGraphThumbMixin):
|
||||
and xml.find("./video").find("item").find("rendition") is not None
|
||||
and xml.find("./video").find("item").find("rendition").find("src") is not None
|
||||
):
|
||||
|
||||
hls_url = xml.find("./video").find("item").find("rendition").find("src").text
|
||||
yield from hlsparse(self.config, self.http.request("get", hls_url), hls_url, output=self.output)
|
||||
|
@ -32,7 +32,6 @@ class Vimeo(Service, OpenGraphThumbMixin):
|
||||
player_data = self.http.request("get", player_url).text
|
||||
|
||||
if player_data:
|
||||
|
||||
jsondata = json.loads(player_data)
|
||||
|
||||
if ("hls" in jsondata["request"]["files"]) and ("fastly_skyfire" in jsondata["request"]["files"]["hls"]["cdns"]):
|
||||
|
@ -14,5 +14,5 @@ with open(initfile) as fd:
|
||||
data = fd.read()
|
||||
|
||||
newstring = re.sub("(__version__ = get_version[^\n]+)", f'__version__ = "{version}"', data)
|
||||
with open(initfile, "wt") as fd:
|
||||
with open(initfile, "w") as fd:
|
||||
fd.write(newstring)
|
||||
|
@ -446,7 +446,12 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=
|
||||
dispcmd = str([command] + args)
|
||||
# remember shell=False, so use git.cmd on windows, not just git
|
||||
process = subprocess.Popen(
|
||||
[command] + args, cwd=cwd, env=env, stdout=subprocess.PIPE, stderr=(subprocess.PIPE if hide_stderr else None), **popen_kwargs
|
||||
[command] + args,
|
||||
cwd=cwd,
|
||||
env=env,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=(subprocess.PIPE if hide_stderr else None),
|
||||
**popen_kwargs,
|
||||
)
|
||||
break
|
||||
except OSError:
|
||||
|
Loading…
Reference in New Issue
Block a user