Split up add params

This commit is contained in:
Rain Clark 2024-04-12 12:53:39 -04:00
parent c7782b46b8
commit 6030f2d0dd

14
main.py
View File

@ -69,15 +69,16 @@ def is_live(channel: str) -> bool:
def download_stream(channel: str) -> None: def download_stream(channel: str) -> None:
"""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 # TODO: Just clean this up at somepoint
addtional_parms: str = "" loging: str = ""
ad_skipping: str = ""
print(log)
if log: if log:
addtional_parms += f" --logfile {download_location}/{channel}/log.txt" loging = f"--loglevel info --logfile {download_location}/{channel}/log.txt"
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" ad_skipping = "--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: str = f"{channel}_{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}.ts" file_name: str = f"{channel}_{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}.ts"
cmd: str = ( cmd: str = f"{streamlink_location} --retry-max 10 {loging} {ad_skipping} -o {download_location}/{channel}/{file_name} twitch.tv/{channel} best"
f"{streamlink_location} --retry-max 10{addtional_parms} -o {download_location}/{channel}/{file_name} twitch.tv/{channel} best" # TODO: Check if the process failed for some reason
)
downloading[channel] = subprocess.Popen( downloading[channel] = subprocess.Popen(
[cmd], [cmd],
shell=True, shell=True,
@ -118,6 +119,7 @@ def main() -> None:
"""Main entry point of the app""" """Main entry point of the app"""
# Run untill progam is killed # Run untill progam is killed
# TODO: Check on the process if it is still alive and restart as needed
while True: while True:
# Exits the program if there is no channels to grab # Exits the program if there is no channels to grab
print("\n------------------------------------") print("\n------------------------------------")