From 91582c67bd53d1a8d2550a3b96c98bced241dbbf Mon Sep 17 00:00:00 2001 From: Rain Date: Sat, 6 Apr 2024 22:30:51 -0400 Subject: [PATCH] Have to use the shell argument for the subprocess --- main.py | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/main.py b/main.py index 91e6107..f0d687d 100755 --- a/main.py +++ b/main.py @@ -53,32 +53,20 @@ def write_log(channel): def download_stream(channel): """Downloads a given channel name in its own subprocess""" + # TODO: Just clean this up at somepoint addtional_parms = "" 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" file_name = f"{channel}_{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}.ts" - cmd = [ - f"{streamlink_location} --loglevel none --retry-max 10 {addtional_parms} -o {download_location}/{channel}/{file_name} twitch.tv/{channel} best", - ] - with open("test.text", "w") as file: - print(cmd) - print(" ".join(cmd)) - file.write(" ".join(cmd)) - subprocess.run(cmd, shell=True) - - # 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) + cmd = 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], + shell=True, + start_new_session=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + ) + write_log(channel) def check_system():