From 698a0d647eaad444d84c6c2f3fc9fe73e4d604ee Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Mon, 17 Oct 2022 12:06:32 -0400 Subject: [PATCH] [125] small wiki fixes --- VERSION | 2 +- docs/conf.py | 3 +- docs/config/libraries.md | 16 ++++++++ docs/metadata/details/schedule.md | 6 ++- modules/config.py | 7 +++- modules/mdblist.py | 5 ++- modules/operations.py | 61 +++++++++++++++++-------------- modules/util.py | 6 ++- plex_meta_manager.py | 7 +++- 9 files changed, 77 insertions(+), 36 deletions(-) diff --git a/VERSION b/VERSION index 2bc49ba7..6ae87cb4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.3-develop124 +1.17.3-develop125 diff --git a/docs/conf.py b/docs/conf.py index 5c7ed29b..570793cc 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -407,7 +407,8 @@ html_theme_options = { ("_menu", "FlixPatrol Builders", "metadata/builders/flixpatrol", [ ("FlixPatrol Top Platform", "metadata/builders/flixpatrol", "#flixpatrol-top"), ("FlixPatrol Popular", "metadata/builders/flixpatrol", "#flixpatrol-popular"), - ("FlixPatrol demographicURLTop Platform", "metadata/builders/flixpatrol", "#flixpatrol-url"), + ("FlixPatrol Demographics", "metadata/builders/flixpatrol", "#flixpatrol-demographics"), + ("FlixPatrol URL", "metadata/builders/flixpatrol", "#flixpatrol-url"), ]), ("_menu", "Reciperr Builders", "metadata/builders/reciperr", [ ("Reciperr List", "metadata/builders/reciperr", "#reciperr-list"), diff --git a/docs/config/libraries.md b/docs/config/libraries.md index 21284735..613457f9 100644 --- a/docs/config/libraries.md +++ b/docs/config/libraries.md @@ -194,6 +194,22 @@ libraries: - file: config/Overlays.yml ``` +#### Schedule Overlays + +You can schedule all overlays from a library by adding `schedule` to `overlay_path` and setting it to [Any Schedule Option](../metadata/details/schedule). + +**You cannot schedule individual Overlay Files.** + +```yaml +libraries: + TV Shows: + metadata_path: + - file: config/TV Shows.yml + overlay_path: + - schedule: weekly(sunday) + - file: config/Overlays.yml +``` + ### Report Path The `report_path` attribute is used to define where to save the YAML Report file. This file is used to store information about what media is added, removed, filtered, and missing from the Plex library compared to what is expected from the Metadata file. diff --git a/docs/metadata/details/schedule.md b/docs/metadata/details/schedule.md index 7b266bb9..9358bc34 100644 --- a/docs/metadata/details/schedule.md +++ b/docs/metadata/details/schedule.md @@ -33,8 +33,10 @@ libraries: - pmm: actor schedule: weekly(friday) overlay_path: - - pmm: imdb - schedule: weekly(saturday) + - schedule: weekly(saturday) + - pmm: audio_codec + - pmm: resolution + - pmm: video_format operations: mass_critic_rating_update: tmdb playlist_files: diff --git a/modules/config.py b/modules/config.py index e25459c5..a0020ca9 100644 --- a/modules/config.py +++ b/modules/config.py @@ -821,6 +821,8 @@ class ConfigFile: if lib and "template_variables" in lib and lib["template_variables"] and isinstance(lib["template_variables"], dict): lib_vars = lib["template_variables"] + logger.separator("Metadata Files", space=False, border=False) + try: if lib and "metadata_path" in lib: if not lib["metadata_path"]: @@ -848,6 +850,8 @@ class ConfigFile: except NotScheduled: params["skip_library"] = True + logger.separator("Overlay Files", space=False, border=False) + params["overlay_path"] = [] params["remove_overlays"] = False params["reapply_overlays"] = False @@ -888,9 +892,10 @@ class ConfigFile: if not self.ignore_schedules: err = e if err: - raise NotScheduled(f"{err}\n\nOverlays not scheduled to run") + raise NotScheduled(f"Overlay Schedule:{err}\n\nOverlays not scheduled to run") params["overlay_path"] = files except NotScheduled as e: + logger.info("") logger.info(e) params["overlay_path"] = [] params["remove_overlays"] = False diff --git a/modules/mdblist.py b/modules/mdblist.py index 4670d7b9..2524a616 100644 --- a/modules/mdblist.py +++ b/modules/mdblist.py @@ -1,7 +1,7 @@ from datetime import datetime from json import JSONDecodeError from modules import util -from modules.util import Failed +from modules.util import Failed, LimitReached from urllib.parse import urlparse logger = util.logger @@ -73,6 +73,8 @@ class Mdblist: self.expiration = expiration try: self._request(imdb_id="tt0080684", ignore_cache=True) + except LimitReached: + self.limit = True except Failed: self.apikey = None raise @@ -110,6 +112,7 @@ class Mdblist: if "response" in response and response["response"] is False: if response["error"] == "API Limit Reached!": self.limit = True + raise LimitReached(f"MdbList Error: {response['error']}") raise Failed(f"MdbList Error: {response['error']}") else: mdb = MDbObj(response) diff --git a/modules/operations.py b/modules/operations.py index 04c1fbba..dba5b4d6 100644 --- a/modules/operations.py +++ b/modules/operations.py @@ -1,7 +1,7 @@ import os, re from datetime import datetime from modules import plex, util -from modules.util import Failed, YAML +from modules.util import Failed, LimitReached, YAML logger = util.logger @@ -193,32 +193,39 @@ class Operations: mdb_item = None if any([o and o.startswith("mdb") for o in self.library.meta_operations]): if self.config.Mdblist.limit is False: - if self.library.is_show and tvdb_id and mdb_item is None: - try: - mdb_item = self.config.Mdblist.get_series(tvdb_id) - except Failed as e: - logger.trace(str(e)) - except Exception: - logger.trace(f"TVDb ID: {tvdb_id}") - raise - if tmdb_id and mdb_item is None: - try: - mdb_item = self.config.Mdblist.get_movie(tmdb_id) - except Failed as e: - logger.trace(str(e)) - except Exception: - logger.trace(f"TMDb ID: {tmdb_id}") - raise - if imdb_id and mdb_item is None: - try: - mdb_item = self.config.Mdblist.get_imdb(imdb_id) - except Failed as e: - logger.trace(str(e)) - except Exception: - logger.trace(f"IMDb ID: {imdb_id}") - raise - if mdb_item is None: - logger.warning(f"No MdbItem for Guid: {item.guid}") + try: + if self.library.is_show and tvdb_id and mdb_item is None: + try: + mdb_item = self.config.Mdblist.get_series(tvdb_id) + except Failed as e: + logger.trace(str(e)) + except Exception: + logger.trace(f"TVDb ID: {tvdb_id}") + raise + if tmdb_id and mdb_item is None: + try: + mdb_item = self.config.Mdblist.get_movie(tmdb_id) + except LimitReached as e: + logger.debug(e) + except Failed as e: + logger.trace(str(e)) + except Exception: + logger.trace(f"TMDb ID: {tmdb_id}") + raise + if imdb_id and mdb_item is None: + try: + mdb_item = self.config.Mdblist.get_imdb(imdb_id) + except LimitReached as e: + logger.debug(e) + except Failed as e: + logger.trace(str(e)) + except Exception: + logger.trace(f"IMDb ID: {imdb_id}") + raise + if mdb_item is None: + logger.warning(f"No MdbItem for Guid: {item.guid}") + except LimitReached as e: + logger.debug(e) def update_rating(attribute, item_attr, display): current = getattr(item, item_attr) diff --git a/modules/util.py b/modules/util.py index b894ad84..b76abe5e 100644 --- a/modules/util.py +++ b/modules/util.py @@ -18,6 +18,9 @@ logger = logging.getLogger("Plex Meta Manager") class TimeoutExpired(Exception): pass +class LimitReached(Exception): + pass + class Failed(Exception): pass @@ -459,9 +462,10 @@ def load_files(files_to_load, method, schedule=None, lib_vars=None): if not ignore_schedules: err = e if err: - logger.warning(f"{err}\n\nMetadata File{'s' if len(current) > 1 else ''} not scheduled to run") + logger.warning(f"Metadata Schedule:{err}\n\nMetadata File{'s' if len(current) > 1 else ''} not scheduled to run") for file_type, file_path, temp_vars, asset_directory in current: logger.warning(f"{file_type}: {file_path}") + logger.info("") continue files.extend(current) else: diff --git a/plex_meta_manager.py b/plex_meta_manager.py index 5710510c..6f49ce54 100644 --- a/plex_meta_manager.py +++ b/plex_meta_manager.py @@ -486,8 +486,11 @@ def run_libraries(config): logger.separator(f"Deleting all Collections from the {library.name} Library", space=False, border=False) logger.info("") for collection in library.get_all_collections(): - logger.info(f"Collection {collection.title} Deleted") - library.query(collection.delete) + try: + library.query(collection.delete) + logger.info(f"Collection {collection.title} Deleted") + except NotFound: + logger.error(f"Collection {collection.title} Failed to Delete") library_status[library.name]["All Collections Deleted"] = str(datetime.now() - time_start).split('.')[0] time_start = datetime.now()