diff --git a/README.md b/README.md index 6abe408..6be7ce2 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,13 @@ # Auto TTV Grabber + +- [Auto TTV Grabber](#auto-ttv-grabber) + - [Getting started](#getting-started) + + ## Getting started -This script relies on [dl-stream](https://codeberg.org/bashuser30/dl-stream) being in your systems path. +This script relies on [streamlink](https://streamlink.github.io) being in your systems path. You can find all of its requirements on the their project page. -This script loops through all of the channels in `channel_list.txt` once per minute checking to seeif the channel is live via a HTTP request. -Once a channel is live a [dl-stream](https://codeberg.org/bashuser30/dl-stream) subprocess spawns in the background downloading the stream to it's default location (`$HOME/Videos/dl-stream/`) +This script loops through all of the channels in `channel_list.txt` once per minute checking to see if the channel is live via a HTTP request. +Once a channel is live a [streamlink](https://streamlink.github.io) subprocess spawns in the background downloading the stream to it's default location (`$HOME/Videos/Stream/`) diff --git a/main.py b/main.py index 274d623..c13ad6f 100755 --- a/main.py +++ b/main.py @@ -54,8 +54,19 @@ def write_log(channel): def download_stream(channel): """Downloads a given channel name in its own subprocess""" + 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" downloading[channel] = subprocess.Popen( - ["dl-stream", "-r", channel], + [ + f"{streamlink_location}", + "--loglevel none", + "--retry-max 10", + addtional_parms, + f"-o {download_location}/{channel}/{datetime.now()}.ts", + f"https://twitch.tv/{channel}", + "best", + ], start_new_session=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -65,10 +76,9 @@ def download_stream(channel): def check_system(): """Makes sure everything is place for the script to run""" - # TODO: Make it fallback to streamlink if dl-stream not present - # Checks if dl-stream is in the systems path - if not shutil.which("dl-stream"): - sys.exit("ERROR: dl-stream is not found in the systems path!") + # Checks if streamlink is in the systems path + if not shutil.which("streamlink"): + sys.exit("ERROR: streamlink is not found in the systems path!") # Checks if the channel_list exists and if not makes one if not os.path.exists("channel_list.txt"): @@ -110,6 +120,7 @@ def main(): print("\n------------------------------------") for channel in channel_list: channel = channel.strip() + # TODO: Have steamlink itself check if the channel is live contents = requests.get("https://www.twitch.tv/" + channel).content.decode( "utf-8" )