Start to add formatting to output

This commit is contained in:
Rain Clark 2024-04-03 14:17:51 -04:00
parent 9c1da788ab
commit 43c07186df

8
main.py Normal file → Executable file
View File

@ -6,6 +6,7 @@ import requests
import os
import sys
import shutil
from datetime import datetime
channel_list = []
downloading = []
@ -43,20 +44,23 @@ while True:
# Exits the program if there is no channels to Grab
if not channel_list:
sys.exit("Please populate the channel_list.txt with one channel per line!")
print("\n------------------------------------")
for channel in channel_list:
channel = channel.strip()
contents = requests.get("https://www.twitch.tv/" + channel).content.decode(
"utf-8"
)
if "isLiveBroadcast" in contents:
print(channel + " is live!")
print("\033[1m" + channel + "\033[0m is \033[32mlive\033[0m!")
if channel not in downloading:
download_stream(channel)
else:
print(channel + " is already downloading")
else:
print(channel + " is not live.")
print(channel + " is \033[31mnot live\033[0m.")
if channel in downloading:
downloading.remove(channel)
print(channel + " is no longer downloading")
print("\n\033[3mLast checked: " + datetime.now().strftime("%H:%M:%S") + "\033[0m")
print("------------------------------------")
time.sleep(60) # Wait 60 Seconds before trying again