From a8f88ffe30f27717210cafda1ea62539a1d5bed5 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 11 Jan 2022 14:37:48 -0500 Subject: [PATCH] add global item_refresh_delay --- modules/builder.py | 8 +++----- modules/config.py | 2 ++ modules/library.py | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/builder.py b/modules/builder.py index 6493eacb..9c4511c2 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -2104,13 +2104,11 @@ class CollectionBuilder: if "item_lock_title" in self.item_details: self.library.edit_query(item, {"title.locked": 1}) if "item_refresh" in self.item_details: + delay = self.item_details["item_refresh_delay"] if "item_refresh_delay" in self.item_details else self.library.item_refresh_delay + if delay > 0: + time.sleep(delay) self.library.query(item.refresh) - item_refresh_delay = int(self.item_details["item_refresh_delay"]) if "item_refresh_delay" in self.item_details else 0 - - if item_refresh_delay > 0: - time.sleep(item_refresh_delay) - if self.library.Radarr and tmdb_paths: if "item_radarr_tag" in self.item_details: self.library.Radarr.edit_tags([t[0] if isinstance(t, tuple) else t for t in tmdb_paths], self.item_details["item_radarr_tag"], self.item_details["apply_tags"]) diff --git a/modules/config.py b/modules/config.py index 4463266b..e9ad96d3 100644 --- a/modules/config.py +++ b/modules/config.py @@ -268,6 +268,7 @@ class ConfigFile: "sync_mode": check_for_attribute(self.data, "sync_mode", parent="settings", default="append", test_list=sync_modes), "default_collection_order": check_for_attribute(self.data, "default_collection_order", parent="settings", default_is_none=True), "minimum_items": check_for_attribute(self.data, "minimum_items", parent="settings", var_type="int", default=1), + "item_refresh_delay": check_for_attribute(self.data, "item_refresh_delay", parent="settings", var_type="int", default=0), "delete_below_minimum": check_for_attribute(self.data, "delete_below_minimum", parent="settings", var_type="bool", default=False), "delete_not_scheduled": check_for_attribute(self.data, "delete_not_scheduled", parent="settings", var_type="bool", default=False), "run_again_delay": check_for_attribute(self.data, "run_again_delay", parent="settings", var_type="int", default=0), @@ -574,6 +575,7 @@ class ConfigFile: params["download_url_assets"] = check_for_attribute(lib, "download_url_assets", parent="settings", var_type="bool", default=self.general["download_url_assets"], do_print=False, save=False) params["show_missing_season_assets"] = check_for_attribute(lib, "show_missing_season_assets", parent="settings", var_type="bool", default=self.general["show_missing_season_assets"], do_print=False, save=False) params["minimum_items"] = check_for_attribute(lib, "minimum_items", parent="settings", var_type="int", default=self.general["minimum_items"], do_print=False, save=False) + params["item_refresh_delay"] = check_for_attribute(lib, "item_refresh_delay", parent="settings", var_type="int", default=self.general["item_refresh_delay"], do_print=False, save=False) params["delete_below_minimum"] = check_for_attribute(lib, "delete_below_minimum", parent="settings", var_type="bool", default=self.general["delete_below_minimum"], do_print=False, save=False) params["delete_not_scheduled"] = check_for_attribute(lib, "delete_not_scheduled", parent="settings", var_type="bool", default=self.general["delete_not_scheduled"], do_print=False, save=False) params["delete_unmanaged_collections"] = check_for_attribute(lib, "delete_unmanaged_collections", parent="settings", var_type="bool", default=False, do_print=False, save=False) diff --git a/modules/library.py b/modules/library.py index b63114a6..3547811f 100644 --- a/modules/library.py +++ b/modules/library.py @@ -49,6 +49,7 @@ class Library(ABC): self.sync_mode = params["sync_mode"] self.default_collection_order = params["default_collection_order"] self.minimum_items = params["minimum_items"] + self.item_refresh_delay = params["item_refresh_delay"] self.delete_below_minimum = params["delete_below_minimum"] self.delete_not_scheduled = params["delete_not_scheduled"] self.missing_only_released = params["missing_only_released"]