From bcbce98d91584e095ddf14ac61964eb3c2db2e02 Mon Sep 17 00:00:00 2001 From: Carsten Burgard Date: Sun, 13 Feb 2022 12:02:15 +0100 Subject: [PATCH] allow lyrics section in yml file to be missing --- PlexBot/__init__.py | 4 ++-- PlexBot/__main__.py | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/PlexBot/__init__.py b/PlexBot/__init__.py index 6768d27..badc36c 100644 --- a/PlexBot/__init__.py +++ b/PlexBot/__init__.py @@ -56,7 +56,7 @@ def load_config(filename: str) -> Dict[str, str]: config["plex"]["log_level"] = levels[config["plex"]["log_level"].upper()] config["discord"]["log_level"] = levels[config["discord"]["log_level"].upper()] - if config["lyrics"]["token"].lower() == "none": - config["lyrics"]["token"] = None + if config["lyrics"] and config["lyrics"]["token"].lower() == "none": + config["lyrics"] = None return config diff --git a/PlexBot/__main__.py b/PlexBot/__main__.py index fc8fb9c..1434d00 100644 --- a/PlexBot/__main__.py +++ b/PlexBot/__main__.py @@ -20,8 +20,11 @@ BASE_URL = config["plex"]["base_url"] PLEX_TOKEN = config["plex"]["token"] 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 root_log = logging.getLogger() plex_log = logging.getLogger("Plex")