Now actually read the config file. 😅

This commit is contained in:
Rain Clark 2024-04-10 16:49:00 -04:00
parent d3a222e27b
commit 5772f1be4b

14
main.py
View File

@ -25,22 +25,16 @@ def load_config() -> None:
print("Reading config file...") print("Reading config file...")
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read("config.ini") config.read("config.ini")
if ( if config.has_option("settings", "streamlink_location"):
config.has_option("settings", "streamlink_location")
and not config["settings"]["streamlink_location"].strip()
):
streamlink_location = config["settings"]["streamlink_location"] streamlink_location = config["settings"]["streamlink_location"]
print(f"Streamlink location: {streamlink_location}") print(f"Streamlink location: {streamlink_location}")
if ( if config.has_option("settings", "download_location"):
config.has_option("settings", "download_location")
and not config["settings"]["download_location"].strip()
):
download_location = config["settings"]["download_location"] download_location = config["settings"]["download_location"]
print(f"Download location: {download_location}") print(f"Download location: {download_location}")
if config.has_option("settings", "skip_ads") and not config["settings"]["skip_ads"]: if config.has_option("settings", "skip_ads"):
skip_ads = bool(config["settings"]["skip_ads"]) skip_ads = bool(config["settings"]["skip_ads"])
print(f"Skip ads: {skip_ads}") print(f"Skip ads: {skip_ads}")
if config.has_option("settings", "log") and not config["settings"]["log"]: if config.has_option("settings", "log"):
log = bool(config["settings"]["log"]) log = bool(config["settings"]["log"])
print(f"Logs: {log}") print(f"Logs: {log}")