forked from fcode/delarte
convert variable in main() to lowercase
This commit is contained in:
parent
d908e4f15b
commit
6401c25205
28
delarte.py
28
delarte.py
|
@ -118,38 +118,38 @@ def write_subtitles(m3u8_url, base_name):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""CLI function, options passed as arguments."""
|
"""CLI function, options passed as arguments."""
|
||||||
(UI_LANG, _, STREAM_ID, SLUG) = urlparse(sys.argv[1]).path[1:-1].split("/")
|
(ui_lang, _, stream_id, _slug) = urlparse(sys.argv[1]).path[1:-1].split("/")
|
||||||
VERSION = " ".join(sys.argv[2:])
|
version = " ".join(sys.argv[2:])
|
||||||
|
|
||||||
if UI_LANG not in ("fr", "de", "en", "es", "pl", "it") or _ != "videos":
|
if ui_lang not in ("fr", "de", "en", "es", "pl", "it") or _ != "videos":
|
||||||
raise ValueError("Invalid URL")
|
raise ValueError("Invalid URL")
|
||||||
|
|
||||||
CONFIG = api_config(UI_LANG, STREAM_ID)
|
config = api_config(ui_lang, stream_id)
|
||||||
TITLE = CONFIG.title
|
title = config.title
|
||||||
VERSIONS = CONFIG.versions
|
versions = config.versions
|
||||||
|
|
||||||
FILENAME = TITLE.replace("/", "-")
|
filename = title.replace("/", "-")
|
||||||
|
|
||||||
if VERSION not in VERSIONS:
|
if version not in versions:
|
||||||
print(TITLE)
|
print(title)
|
||||||
for v, (_, l) in VERSIONS.items():
|
for v, (_, l) in versions.items():
|
||||||
print(f"\t{v} : {l}")
|
print(f"\t{v} : {l}")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
M3U8_URL, VERSION_NAME = VERSIONS[VERSION]
|
m3u8_url, _version_name = versions[version]
|
||||||
|
|
||||||
write_subtitles(M3U8_URL, FILENAME)
|
write_subtitles(m3u8_url, filename)
|
||||||
|
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
[
|
[
|
||||||
FFMPEG,
|
FFMPEG,
|
||||||
"-i",
|
"-i",
|
||||||
M3U8_URL,
|
m3u8_url,
|
||||||
"-c",
|
"-c",
|
||||||
"copy",
|
"copy",
|
||||||
"-bsf:a",
|
"-bsf:a",
|
||||||
"aac_adtstoasc",
|
"aac_adtstoasc",
|
||||||
f"{FILENAME}.mp4",
|
f"{filename}.mp4",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user