allow lyrics section in yml file to be missing

This commit is contained in:
Carsten Burgard 2022-02-13 12:02:15 +01:00
parent 6521e7e26c
commit bcbce98d91
2 changed files with 7 additions and 4 deletions

View File

@ -56,7 +56,7 @@ def load_config(filename: str) -> Dict[str, str]:
config["plex"]["log_level"] = levels[config["plex"]["log_level"].upper()] config["plex"]["log_level"] = levels[config["plex"]["log_level"].upper()]
config["discord"]["log_level"] = levels[config["discord"]["log_level"].upper()] config["discord"]["log_level"] = levels[config["discord"]["log_level"].upper()]
if config["lyrics"]["token"].lower() == "none": if config["lyrics"] and config["lyrics"]["token"].lower() == "none":
config["lyrics"]["token"] = None config["lyrics"] = None
return config return config

View File

@ -20,8 +20,11 @@ BASE_URL = config["plex"]["base_url"]
PLEX_TOKEN = config["plex"]["token"] PLEX_TOKEN = config["plex"]["token"]
LIBRARY_NAME = config["plex"]["library_name"] LIBRARY_NAME = config["plex"]["library_name"]
LYRICS_TOKEN = config["lyrics"]["token"] if config["lyrics"]:
LYRICS_TOKEN = config["lyrics"]["token"]
else:
LYRICS_TOKEN = None
# Set appropiate log level # Set appropiate log level
root_log = logging.getLogger() root_log = logging.getLogger()
plex_log = logging.getLogger("Plex") plex_log = logging.getLogger("Plex")