From 6016c54e1518a850102b6d09c6b51b3cef721a2d Mon Sep 17 00:00:00 2001 From: davidemarcoli Date: Thu, 11 Jul 2024 20:54:29 +0200 Subject: [PATCH] fix: validate rd user data and updater settings on startup --- src/program/downloaders/realdebrid.py | 2 ++ src/program/program.py | 1 + src/program/updaters/__init__.py | 8 +++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/program/downloaders/realdebrid.py b/src/program/downloaders/realdebrid.py index 7eef22e0..555a8263 100644 --- a/src/program/downloaders/realdebrid.py +++ b/src/program/downloaders/realdebrid.py @@ -96,6 +96,8 @@ def validate(self) -> bool: logger.error("Connection to Real-Debrid timed out.") except Exception as e: logger.exception(f"Failed to validate Real-Debrid settings: {e}") + except: + logger.error("Couldn't parse user data response from Real-Debrid.") return False diff --git a/src/program/program.py b/src/program/program.py index 362a051e..b7caf478 100644 --- a/src/program/program.py +++ b/src/program/program.py @@ -102,6 +102,7 @@ def validate(self) -> bool: any(s.initialized for s in self.library_services.values()), any(s.initialized for s in self.indexing_services.values()), all(s.initialized for s in self.processing_services.values()), + self.processing_services[Downloader].initialized, ) ) diff --git a/src/program/updaters/__init__.py b/src/program/updaters/__init__.py index b176ca8e..2b789d13 100644 --- a/src/program/updaters/__init__.py +++ b/src/program/updaters/__init__.py @@ -18,7 +18,13 @@ def __init__(self): def validate(self) -> bool: """Validate that at least one updater service is initialized.""" - return any(service.initialized for service in self.services.values()) + initialized_services = [service for service in self.services.values() if service.initialized] + + if self.services[LocalUpdater].initialized and len(initialized_services) > 1: + logger.error("Local updater can not be used together with other updaters.") + return False + + return len(initialized_services) > 0 def run(self, item: MediaItem): if not self.initialized: