Skip to content

Commit

Permalink
[patch] Merge pull request #131 from Feramance/127-attributeerror-in-…
Browse files Browse the repository at this point in the history
…headless-mode

Fix headless mode category path checks
  • Loading branch information
Feramance authored Nov 14, 2024
2 parents fd06a19 + 52e6cb9 commit 4506eb9
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions qBitrr/arss.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,26 @@ def __init__(
fh = logging.FileHandler(logfile)
self.logger.addHandler(fh)
run_logs(self.logger)
categories = self.manager.qbit_manager.client.torrent_categories.categories
try:
categ = categories[self.category]
path = categ["savePath"]
if path:
self.logger.trace("Category exists with save path [%s]", path)
self.completed_folder = pathlib.Path(path)
else:
self.logger.trace("Category exists without save path")
self.completed_folder = pathlib.Path(COMPLETED_DOWNLOAD_FOLDER).joinpath(
self.category

if not QBIT_DISABLED:
categories = self.manager.qbit_manager.client.torrent_categories.categories
try:
categ = categories[self.category]
path = categ["savePath"]
if path:
self.logger.trace("Category exists with save path [%s]", path)
self.completed_folder = pathlib.Path(path)
else:
self.logger.trace("Category exists without save path")
self.completed_folder = pathlib.Path(COMPLETED_DOWNLOAD_FOLDER).joinpath(
self.category
)
except KeyError:
self.completed_folder = pathlib.Path(COMPLETED_DOWNLOAD_FOLDER).joinpath(self.category)
self.manager.qbit_manager.client.torrent_categories.create_category(
self.category, save_path=self.completed_folder
)
except KeyError:
self.completed_folder = pathlib.Path(COMPLETED_DOWNLOAD_FOLDER).joinpath(self.category)
self.manager.qbit_manager.client.torrent_categories.create_category(
self.category, save_path=self.completed_folder
)

if not self.completed_folder.exists() and not SEARCH_ONLY:
try:
self.completed_folder.mkdir(parents=True, exist_ok=True)
Expand Down

0 comments on commit 4506eb9

Please sign in to comment.