mirror of
https://gitgud.io/Melon__Bread/auto-ttv-grabber.git
synced 2024-11-25 00:38:35 -05:00
Fixed formatting and now logs output of dl-stream
This commit is contained in:
parent
43c07186df
commit
0e64f7477b
20
main.py
20
main.py
@ -1,23 +1,23 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import subprocess
|
|
||||||
import time
|
|
||||||
import requests
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import shutil
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
channel_list = []
|
channel_list = []
|
||||||
downloading = []
|
downloading = []
|
||||||
|
|
||||||
|
|
||||||
def download_stream(channel):
|
def download_stream(channel):
|
||||||
downloading.append(channel)
|
downloading.append(channel)
|
||||||
# TODO: Output dl-stream to a log file
|
with open("log.txt", "w") as log:
|
||||||
subprocess.Popen(
|
subprocess.Popen(
|
||||||
["dl-stream", "-r", channel], start_new_session=True, stdout=subprocess.DEVNULL
|
["dl-stream", "-r", channel], start_new_session=True, stdout=log
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Checks if dl-stream is in the systems path
|
# Checks if dl-stream is in the systems path
|
||||||
@ -57,7 +57,7 @@ while True:
|
|||||||
else:
|
else:
|
||||||
print(channel + " is already downloading")
|
print(channel + " is already downloading")
|
||||||
else:
|
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:
|
if channel in downloading:
|
||||||
downloading.remove(channel)
|
downloading.remove(channel)
|
||||||
print(channel + " is no longer downloading")
|
print(channel + " is no longer downloading")
|
||||||
|
Loading…
Reference in New Issue
Block a user