From ebdf085a243416baa11f1457cf23f3c35b4f5d26 Mon Sep 17 00:00:00 2001 From: bobokun Date: Sun, 11 Feb 2024 16:38:19 -0500 Subject: [PATCH] resolves #115 --- VERSION | 2 +- modules/config.py | 9 +++++++++ modules/core/category.py | 5 +++-- modules/core/share_limits.py | 3 ++- modules/core/tag_nohardlinks.py | 4 +++- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index cbbf0a0..0f59914 100755 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.0.9-develop6 +4.0.9-develop7 diff --git a/modules/config.py b/modules/config.py index a604b9c..d6c82bd 100755 --- a/modules/config.py +++ b/modules/config.py @@ -169,6 +169,15 @@ class Config: self.data, "share_limits_tag", parent="settings", default=share_limits_tag ), "cross_seed_tag": self.util.check_for_attribute(self.data, "cross_seed_tag", parent="settings", default="cross-seed"), + "cat_filter_completed": self.util.check_for_attribute( + self.data, "cat_filter_completed", parent="settings", var_type="bool", default=True + ), + "share_limits_filter_completed": self.util.check_for_attribute( + self.data, "share_limits_filter_completed", parent="settings", var_type="bool", default=True + ), + "tag_nohardlinks_filter_completed": self.util.check_for_attribute( + self.data, "tag_nohardlinks_filter_completed", parent="settings", var_type="bool", default=True + ), } self.tracker_error_tag = self.settings["tracker_error_tag"] diff --git a/modules/core/category.py b/modules/core/category.py index f2d50c3..2077584 100644 --- a/modules/core/category.py +++ b/modules/core/category.py @@ -14,6 +14,7 @@ class Category: self.torrents_updated = [] # List of torrents updated self.notify_attr = [] # List of single torrent attributes to send to notifiarr self.uncategorized_mapping = "Uncategorized" + self.status_filter = "completed" if self.config.settings["cat_filter_completed"] else "all" self.category() self.config.webhooks_factory.notify(self.torrents_updated, self.notify_attr, group_by="category") @@ -21,7 +22,7 @@ class Category: def category(self): """Update category for torrents that don't have any category defined and returns total number categories updated""" logger.separator("Updating Categories", space=False, border=False) - torrent_list = self.qbt.get_torrents({"category": "", "status_filter": "completed"}) + torrent_list = self.qbt.get_torrents({"category": "", "status_filter": self.status_filter}) for torrent in torrent_list: new_cat = self.get_tracker_cat(torrent) or self.qbt.get_category(torrent.save_path) if new_cat == self.uncategorized_mapping: @@ -32,7 +33,7 @@ class Category: # Change categories if self.config.cat_change: for old_cat in self.config.cat_change: - torrent_list = self.qbt.get_torrents({"category": old_cat, "status_filter": "completed"}) + torrent_list = self.qbt.get_torrents({"category": old_cat, "status_filter": self.status_filter}) for torrent in torrent_list: new_cat = self.config.cat_change[old_cat] self.update_cat(torrent, new_cat, True) diff --git a/modules/core/share_limits.py b/modules/core/share_limits.py index 68bd814..758868d 100644 --- a/modules/core/share_limits.py +++ b/modules/core/share_limits.py @@ -24,6 +24,7 @@ class ShareLimits: # meets the criteria for ratio limit/seed limit for deletion self.stats_deleted_contents = 0 # counter for the number of torrents that \ # meets the criteria for ratio limit/seed limit for deletion including contents \ + self.status_filter = "completed" if self.config.settings["share_limits_filter_completed"] else "all" self.tdel_dict = {} # dictionary to track the torrent names and content path that meet the deletion criteria self.root_dir = qbit_manager.config.root_dir # root directory of torrents @@ -40,7 +41,7 @@ class ShareLimits: def update_share_limits(self): """Updates share limits for torrents based on grouping""" logger.separator("Updating Share Limits based on priority", space=False, border=False) - torrent_list = self.qbt.get_torrents({"status_filter": "completed"}) + torrent_list = self.qbt.get_torrents({"status_filter": self.status_filter}) self.assign_torrents_to_group(torrent_list) for group_name, group_config in self.share_limits_config.items(): torrents = group_config["torrents"] diff --git a/modules/core/tag_nohardlinks.py b/modules/core/tag_nohardlinks.py index d4a628c..b6f0542 100644 --- a/modules/core/tag_nohardlinks.py +++ b/modules/core/tag_nohardlinks.py @@ -22,6 +22,8 @@ class TagNoHardLinks: self.torrents_updated_untagged = [] # List of torrents updated self.notify_attr_untagged = [] # List of single torrent attributes to send to notifiarr + self.status_filter = "completed" if self.config.settings["tag_nohardlinks_filter_completed"] else "all" + self.tag_nohardlinks() self.config.webhooks_factory.notify(self.torrents_updated_tagged, self.notify_attr_tagged, group_by="tag") @@ -87,7 +89,7 @@ class TagNoHardLinks: nohardlinks = self.nohardlinks check_hardlinks = util.CheckHardLinks(self.root_dir, self.remote_dir) for category in nohardlinks: - torrent_list = self.qbt.get_torrents({"category": category, "status_filter": "completed"}) + torrent_list = self.qbt.get_torrents({"category": category, "status_filter": self.status_filter}) if len(torrent_list) == 0: ex = ( "No torrents found in the category ("