Have to use the shell argument for the subprocess

This commit is contained in:
Rain Clark 2024-04-06 22:30:51 -04:00
parent bd874d7245
commit 91582c67bd

32
main.py
View File

@ -53,32 +53,20 @@ def write_log(channel):
def download_stream(channel): def download_stream(channel):
"""Downloads a given channel name in its own subprocess""" """Downloads a given channel name in its own subprocess"""
# TODO: Just clean this up at somepoint
addtional_parms = "" addtional_parms = ""
if skip_ads: if skip_ads:
addtional_parms = "--twitch-proxy-playlist=https://lb-eu.cdn-perfprod.com,https://lb-eu2.cdn-perfprod.com,https://lb-na.cdn-perfprod.com,https://lb-as.cdn-perfprod.com,https://as.luminous.dev --twitch-disable-ads" addtional_parms = "--twitch-proxy-playlist=https://lb-eu.cdn-perfprod.com,https://lb-eu2.cdn-perfprod.com,https://lb-na.cdn-perfprod.com,https://lb-as.cdn-perfprod.com,https://as.luminous.dev --twitch-disable-ads"
file_name = f"{channel}_{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}.ts" file_name = f"{channel}_{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}.ts"
cmd = [ cmd = f"{streamlink_location} --loglevel none --retry-max 10 {addtional_parms} -o {download_location}/{channel}/{file_name} twitch.tv/{channel} best"
f"{streamlink_location} --loglevel none --retry-max 10 {addtional_parms} -o {download_location}/{channel}/{file_name} twitch.tv/{channel} best", downloading[channel] = subprocess.Popen(
] [cmd],
with open("test.text", "w") as file: shell=True,
print(cmd) start_new_session=True,
print(" ".join(cmd)) stdout=subprocess.PIPE,
file.write(" ".join(cmd)) stderr=subprocess.STDOUT,
subprocess.run(cmd, shell=True) )
write_log(channel)
# downloading[channel] = subprocess.Popen(
# [
# f"{streamlink_location}",
# "--loglevel none",
# "--retry-max 10",
# f"{addtional_parms}",
# f"-o {download_location}/{channel}/{file_name}",
# f"twitch.tv/{channel}",
# "best",
# ]
# )
# write_log(channel)
def check_system(): def check_system():