Fixed formatting and now logs output of dl-stream

This commit is contained in:
Rain Clark 2024-04-03 15:13:14 -04:00
parent 43c07186df
commit 0e64f7477b

16
main.py
View File

@ -1,22 +1,22 @@
#!/usr/bin/env python3
import subprocess
import time
import requests
import os
import sys
import shutil
import subprocess
import sys
import time
from datetime import datetime
import requests
channel_list = []
downloading = []
def download_stream(channel):
downloading.append(channel)
# TODO: Output dl-stream to a log file
with open("log.txt", "w") as log:
subprocess.Popen(
["dl-stream", "-r", channel], start_new_session=True, stdout=subprocess.DEVNULL
["dl-stream", "-r", channel], start_new_session=True, stdout=log
)
@ -57,7 +57,7 @@ while True:
else:
print(channel + " is already downloading")
else:
print(channel + " is \033[31mnot live\033[0m.")
print("\033[1m" + channel + "\033[0m is \033[31mnot live\033[0m.")
if channel in downloading:
downloading.remove(channel)
print(channel + " is no longer downloading")