diff --git a/CHANGELOG b/CHANGELOG
index 096ebe2c..63df5551 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -16,6 +16,7 @@ Trakt Builder `trakt_userlist` value `recommendations` removed and `favorites` a
Mass Update operations now can be given a list of sources to fall back on when one fails including a manual source.
`mass_content_rating_update` has a new source `mdb_age_rating`
`mass_originally_available_update` has a new source `mdb_digital`
+`plex` attributes `clean_bundles`, `empty_trash`, and `optimize` can now take any schedule options to be run only when desired.
# Defaults
diff --git a/VERSION b/VERSION
index ce9352a0..7ed8de48 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.20.0-develop21
+1.20.0-develop22
diff --git a/docs/config/plex.md b/docs/config/plex.md
index 41f6de1b..cb3abb3a 100644
--- a/docs/config/plex.md
+++ b/docs/config/plex.md
@@ -22,15 +22,15 @@ plex:
optimize: false
```
-| Attribute | Allowed Values | Default | Required |
-|:----------------|:------------------------------------------------------------------------|:--------|:------------------------------------------:|
-| `url` | Plex Server URL
Example: http://192.168.1.12:32400 | N/A | :fontawesome-solid-circle-check:{ .green } |
-| `token` | Plex Server Authentication Token | N/A | :fontawesome-solid-circle-check:{ .green } |
-| `timeout` | Plex Server Timeout | 60 | :fontawesome-solid-circle-xmark:{ .red } |
-| `db_cache` | Plex Server Database Cache Size | None | :fontawesome-solid-circle-xmark:{ .red } |
-| `clean_bundles` | Runs Clean Bundles on the Server after all Collection Files are run | false | :fontawesome-solid-circle-xmark:{ .red } |
-| `empty_trash` | Runs Empty Trash on the Server after all Collection Files are run | false | :fontawesome-solid-circle-xmark:{ .red } |
-| `optimize` | Runs Optimize on the Server after all Collection Files are run | false | :fontawesome-solid-circle-xmark:{ .red } |
+| Attribute | Allowed Values | Default | Required |
+|:----------------|:-------------------------------------------------------------------------------------------------------------------------------|:--------|:------------------------------------------:|
+| `url` | Plex Server URL
Example: http://192.168.1.12:32400 | N/A | :fontawesome-solid-circle-check:{ .green } |
+| `token` | Plex Server Authentication Token | N/A | :fontawesome-solid-circle-check:{ .green } |
+| `timeout` | Plex Server Timeout | 60 | :fontawesome-solid-circle-xmark:{ .red } |
+| `db_cache` | Plex Server Database Cache Size | None | :fontawesome-solid-circle-xmark:{ .red } |
+| `clean_bundles` | Runs Clean Bundles on the Server after all Collection Files are run
(`true`, `false` or Any [schedule option](schedule.md)) | false | :fontawesome-solid-circle-xmark:{ .red } |
+| `empty_trash` | Runs Empty Trash on the Server after all Collection Files are run
(`true`, `false` or Any [schedule option](schedule.md)) | false | :fontawesome-solid-circle-xmark:{ .red } |
+| `optimize` | Runs Optimize on the Server after all Collection Files are run
(`true`, `false` or Any [schedule option](schedule.md)) | false | :fontawesome-solid-circle-xmark:{ .red } |
???+ warning
diff --git a/modules/config.py b/modules/config.py
index c6efd30d..512711f4 100644
--- a/modules/config.py
+++ b/modules/config.py
@@ -739,11 +739,17 @@ class ConfigFile:
"url": check_for_attribute(self.data, "url", parent="plex", var_type="url", default_is_none=True),
"token": check_for_attribute(self.data, "token", parent="plex", default_is_none=True),
"timeout": check_for_attribute(self.data, "timeout", parent="plex", var_type="int", default=60),
- "db_cache": check_for_attribute(self.data, "db_cache", parent="plex", var_type="int", default_is_none=True),
- "clean_bundles": check_for_attribute(self.data, "clean_bundles", parent="plex", var_type="bool", default=False),
- "empty_trash": check_for_attribute(self.data, "empty_trash", parent="plex", var_type="bool", default=False),
- "optimize": check_for_attribute(self.data, "optimize", parent="plex", var_type="bool", default=False)
+ "db_cache": check_for_attribute(self.data, "db_cache", parent="plex", var_type="int", default_is_none=True)
}
+ for attr in ["clean_bundles", "empty_trash", "optimize"]:
+ try:
+ self.general["plex"][attr] = check_for_attribute(self.data, attr, parent="plex", var_type="bool", default=False, throw=True)
+ except Failed as e:
+ if "plex" in self.data and attr in self.data["plex"] and self.data["plex"][attr]:
+ self.general["plex"][attr] = self.data["plex"][attr]
+ else:
+ self.general["plex"][attr] = False
+ logger.warning(str(e).replace("Error", "Warning"))
self.general["radarr"] = {
"url": check_for_attribute(self.data, "url", parent="radarr", var_type="url", default_is_none=True),
"token": check_for_attribute(self.data, "token", parent="radarr", default_is_none=True),
@@ -956,15 +962,15 @@ class ConfigFile:
sources = [sources]
try:
for source in sources:
- if source == "omdb" and self.OMDb is None:
+ if source and source == "omdb" and self.OMDb is None:
raise Failed(f"{source} without a successful OMDb Connection")
- if source and source.startswith("mdb") and not self.Mdblist.has_key:
+ if source and str(source).startswith("mdb") and not self.Mdblist.has_key:
raise Failed(f"{source} without a successful MdbList Connection")
- if source and source.startswith("anidb") and not self.AniDB.is_authorized:
+ if source and str(source).startswith("anidb") and not self.AniDB.is_authorized:
raise Failed(f"{source} without a successful AniDB Connection")
- if source and source.startswith("mal") and self.MyAnimeList is None:
+ if source and str(source).startswith("mal") and self.MyAnimeList is None:
raise Failed(f"{source} without a successful MyAnimeList Connection")
- if source and source.startswith("trakt") and self.Trakt is None:
+ if source and str(source).startswith("trakt") and self.Trakt is None:
raise Failed(f"{source} without a successful Trakt Connection")
except Failed as e:
logger.error(f"Config Error: {mass_key} cannot use {e}")
@@ -1121,11 +1127,21 @@ class ConfigFile:
"url": check_for_attribute(lib, "url", parent="plex", var_type="url", default=self.general["plex"]["url"], req_default=True, save=False),
"token": check_for_attribute(lib, "token", parent="plex", default=self.general["plex"]["token"], req_default=True, save=False),
"timeout": check_for_attribute(lib, "timeout", parent="plex", var_type="int", default=self.general["plex"]["timeout"], save=False),
- "db_cache": check_for_attribute(lib, "db_cache", parent="plex", var_type="int", default=self.general["plex"]["db_cache"], default_is_none=True, save=False),
- "clean_bundles": check_for_attribute(lib, "clean_bundles", parent="plex", var_type="bool", default=self.general["plex"]["clean_bundles"], save=False),
- "empty_trash": check_for_attribute(lib, "empty_trash", parent="plex", var_type="bool", default=self.general["plex"]["empty_trash"], save=False),
- "optimize": check_for_attribute(lib, "optimize", parent="plex", var_type="bool", default=self.general["plex"]["optimize"], save=False)
+ "db_cache": check_for_attribute(lib, "db_cache", parent="plex", var_type="int", default=self.general["plex"]["db_cache"], default_is_none=True, save=False)
}
+ for attr in ["clean_bundles", "empty_trash", "optimize"]:
+ try:
+ params["plex"][attr] = check_for_attribute(lib, attr, parent="plex", var_type="bool", save=False, throw=True)
+ except Failed as er:
+ test = lib["plex"][attr] if "plex" in lib and attr in lib["plex"] and lib["plex"][attr] else self.general["plex"][attr]
+ params["plex"][attr] = False
+ if test is not True and test is not False:
+ try:
+ util.schedule_check(attr, test, current_time, self.run_hour)
+ params["plex"][attr] = True
+ except NotScheduled:
+ logger.info(f"Skipping Operation Not Scheduled for {test}")
+
if params["plex"]["url"].lower() == "env":
params["plex"]["url"] = self.env_plex_url
if params["plex"]["token"].lower() == "env":