diff --git a/VERSION b/VERSION index 45f7112b..b85d486b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.1-develop39 +1.17.1-develop40 diff --git a/docs/metadata/details/setting.md b/docs/metadata/details/setting.md index c82f7d62..0db24216 100644 --- a/docs/metadata/details/setting.md +++ b/docs/metadata/details/setting.md @@ -29,6 +29,7 @@ All the following attributes serve various functions as how the collection/playl | `test` | **Description:** When running in Test Mode (`--run-tests` [option](../../home/environmental)) only collections/playlists with `test: true` will be run.
**Default:** `false`
**Values:** `true` or `false` | | `changes_webhooks` | **Description:** Used to specify a collection/playlist changes webhook for just this collection/playlist.
**Values:** List of webhooks | | `sync_to_trakt_list` | **Description:** Used to specify a trakt list you want the collection/playlist synced to.
**Values:** Trakt List Slug you want to sync to | -| `sync_missing_to_trakt_list` | **Description:** Used to also sync missing items to the Trakt List specified by `sync_to_trakt_list`.
**Values:** `ture` or `false` | +| `sync_missing_to_trakt_list` | **Description:** Used to also sync missing items to the Trakt List specified by `sync_to_trakt_list`.
**Default:** `trfalseue`
**Values:** `true` or `false` | | `allowed_library_types` | **Description:** Used to specify the types of libraries that this definition can work with.
Multiple can be used for one definition as a list or comma separated string. One `false` will cause it to fail.
**Values:** `movie`, `show`, `artist`, `true`, `false` | | `default_percent` | **Description:** Used to declare the default percent for `episodes`, `seasons`, `tracks`, and `albums` [special filters](../filters.md#special-filters). Default is 50.
**Values:** Integer between 1 and 100 | +| `ignore_blank_results` | **Description:** Used to not have Errors resulting from blank results from builders
**Default:** `false`
**Values:** `true` or `false` | diff --git a/modules/builder.py b/modules/builder.py index eea42c7a..176d44bf 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -439,6 +439,13 @@ class CollectionBuilder: logger.debug(f"Value: {data[methods['build_collection']]}") self.build_collection = util.parse(self.Type, "build_collection", self.data, datatype="bool", methods=methods, default=True) + self.ignore_blank_results = False + if "ignore_blank_results" in methods and not self.playlist: + logger.debug("") + logger.debug("Validating Method: ignore_blank_results") + logger.debug(f"Value: {data[methods['ignore_blank_results']]}") + self.ignore_blank_results = util.parse(self.Type, "ignore_blank_results", self.data, datatype="bool", methods=methods, default=True) + self.blank_collection = False if "blank_collection" in methods and not self.playlist and not self.overlay: logger.debug("") diff --git a/modules/overlays.py b/modules/overlays.py index fdb22825..84860cb8 100644 --- a/modules/overlays.py +++ b/modules/overlays.py @@ -2,7 +2,7 @@ import os, re, time from datetime import datetime from modules import plex, util, overlay from modules.builder import CollectionBuilder -from modules.util import Failed, NotScheduled +from modules.util import Failed, NonExisting, NotScheduled from plexapi.exceptions import BadRequest from plexapi.video import Movie, Show, Season, Episode from PIL import Image, ImageFilter @@ -315,7 +315,16 @@ class Overlays: logger.debug("") logger.debug(f"Builder: {method}: {value}") logger.info("") - builder.filter_and_save_items(builder.gather_ids(method, value)) + try: + builder.filter_and_save_items(builder.gather_ids(method, value)) + except NonExisting as e: + if builder.ignore_blank_results: + logger.warning(e) + else: + raise Failed(e) + + if not builder.added_items and builder.ignore_blank_results: + raise NonExisting(f"Overlay Warning: No items found") if builder.filters or builder.tmdb_filters: logger.info("") @@ -336,6 +345,8 @@ class Overlays: logger.info(f"{len(added_titles) if added_titles else 'No'} Items found for {builder.overlay.mapping_name}") except NotScheduled as e: logger.info(e) + except NonExisting as e: + logger.warning(e) except Failed as e: logger.stacktrace() logger.error(e) diff --git a/plex_meta_manager.py b/plex_meta_manager.py index 48c6340c..8fe04196 100644 --- a/plex_meta_manager.py +++ b/plex_meta_manager.py @@ -115,7 +115,7 @@ from modules import util util.logger = logger from modules.builder import CollectionBuilder from modules.config import ConfigFile -from modules.util import Failed, NotScheduled, Deleted +from modules.util import Failed, NonExisting, NotScheduled, Deleted def my_except_hook(exctype, value, tb): if issubclass(exctype, KeyboardInterrupt): @@ -568,7 +568,16 @@ def run_collection(config, library, metadata, requested_collections): logger.debug("") logger.debug(f"Builder: {method}: {value}") logger.info("") - builder.filter_and_save_items(builder.gather_ids(method, value)) + try: + builder.filter_and_save_items(builder.gather_ids(method, value)) + except NonExisting as e: + if builder.ignore_blank_results: + logger.warning(e) + else: + raise Failed(e) + + if not builder.added_items and builder.ignore_blank_results: + raise NonExisting(f"Overlay Warning: No items found") if builder.filters or builder.tmdb_filters: logger.info("") @@ -659,6 +668,9 @@ def run_collection(config, library, metadata, requested_collections): if builder.run_again and (len(builder.run_again_movies) > 0 or len(builder.run_again_shows) > 0): library.run_again.append(builder) + except NonExisting as e: + logger.warning(e) + library.status[str(mapping_name)]["status"] = "Ignored" except NotScheduled as e: logger.info(e) if str(e).endswith("and was deleted"):