[40] add ignore_blank_results

pull/970/head
meisnate12 2 years ago
parent 32782005d9
commit eee9272d71

@ -1 +1 @@
1.17.1-develop39
1.17.1-develop40

@ -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.<br>**Default:** `false`<br>**Values:** `true` or `false` |
| `changes_webhooks` | **Description:** Used to specify a collection/playlist changes webhook for just this collection/playlist.<br>**Values:** List of webhooks |
| `sync_to_trakt_list` | **Description:** Used to specify a trakt list you want the collection/playlist synced to.<br>**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`.<br>**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`.<br>**Default:** `trfalseue`<br>**Values:** `true` or `false` |
| `allowed_library_types` | **Description:** Used to specify the types of libraries that this definition can work with.<br>Multiple can be used for one definition as a list or comma separated string. One `false` will cause it to fail.<br>**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.<br>**Values:** Integer between 1 and 100 |
| `ignore_blank_results` | **Description:** Used to not have Errors resulting from blank results from builders<br>**Default:** `false`<br>**Values:** `true` or `false` |

@ -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("")

@ -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("")
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)

@ -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("")
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"):

Loading…
Cancel
Save