mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-09-13 08:34:51 +08:00
Additional error checking to fix #282
This commit is contained in:
parent
8684066e40
commit
3a8bdf526f
2 changed files with 25 additions and 28 deletions
|
@ -110,27 +110,28 @@ class Config:
|
|||
self.data["notifiarr"] = self.data.pop("notifiarr")
|
||||
if "webhooks" in self.data:
|
||||
temp = self.data.pop("webhooks")
|
||||
if "function" not in temp or ("function" in temp and temp["function"] is None):
|
||||
temp["function"] = {}
|
||||
if temp is not None:
|
||||
if "function" not in temp or ("function" in temp and temp["function"] is None):
|
||||
temp["function"] = {}
|
||||
|
||||
def hooks(attr):
|
||||
if attr in temp:
|
||||
items = temp.pop(attr)
|
||||
if items:
|
||||
temp["function"][attr] = items
|
||||
if attr not in temp["function"]:
|
||||
temp["function"][attr] = {}
|
||||
temp["function"][attr] = None
|
||||
def hooks(attr):
|
||||
if attr in temp:
|
||||
items = temp.pop(attr)
|
||||
if items:
|
||||
temp["function"][attr] = items
|
||||
if attr not in temp["function"]:
|
||||
temp["function"][attr] = {}
|
||||
temp["function"][attr] = None
|
||||
|
||||
hooks("cross_seed")
|
||||
hooks("recheck")
|
||||
hooks("cat_update")
|
||||
hooks("tag_update")
|
||||
hooks("rem_unregistered")
|
||||
hooks("rem_orphaned")
|
||||
hooks("tag_nohardlinks")
|
||||
hooks("cleanup_dirs")
|
||||
self.data["webhooks"] = temp
|
||||
hooks("cross_seed")
|
||||
hooks("recheck")
|
||||
hooks("cat_update")
|
||||
hooks("tag_update")
|
||||
hooks("rem_unregistered")
|
||||
hooks("rem_orphaned")
|
||||
hooks("tag_nohardlinks")
|
||||
hooks("cleanup_dirs")
|
||||
self.data["webhooks"] = temp
|
||||
if "bhd" in self.data:
|
||||
self.data["bhd"] = self.data.pop("bhd")
|
||||
self.dry_run = self.commands["dry_run"]
|
||||
|
|
|
@ -377,16 +377,12 @@ def start():
|
|||
try:
|
||||
cfg = Config(default_dir, args)
|
||||
qbit_manager = cfg.qbt
|
||||
|
||||
except Exception as ex:
|
||||
if "Qbittorrent Error" in ex.args[0]:
|
||||
logger.print_line(ex, "CRITICAL")
|
||||
logger.print_line("Exiting scheduled Run.", "CRITICAL")
|
||||
finished_run()
|
||||
return None
|
||||
else:
|
||||
logger.stacktrace()
|
||||
logger.print_line(ex, "CRITICAL")
|
||||
logger.stacktrace()
|
||||
logger.print_line(ex, "CRITICAL")
|
||||
logger.print_line("Exiting scheduled Run.", "CRITICAL")
|
||||
finished_run()
|
||||
return None
|
||||
|
||||
if qbit_manager:
|
||||
# Set Category
|
||||
|
|
Loading…
Add table
Reference in a new issue