Skip to content

Commit

Permalink
Merge pull request #507 from rivenmedia/bugfix/more-startup-validation
Browse files Browse the repository at this point in the history
fix: validate rd user data and updater settings on startup
  • Loading branch information
Gaisberg authored Jul 23, 2024
2 parents 308c5ac + 6016c54 commit 522bde0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/program/downloaders/realdebrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
1 change: 1 addition & 0 deletions src/program/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
)

Expand Down
8 changes: 7 additions & 1 deletion src/program/updaters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 522bde0

Please sign in to comment.