From 2c39fa0b7404a058cf5ff4b04d7510514a00971b Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Thu, 14 Jul 2022 09:46:33 -0400 Subject: [PATCH] [25] run-metadata now ignores more --- .github/workflows/nightly.yml | 2 +- VERSION | 2 +- modules/library.py | 5 ++++- modules/meta.py | 7 +++++-- plex_meta_manager.py | 23 ++++++++++++----------- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 356b8092..5c29d62e 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -38,7 +38,7 @@ jobs: with: context: ./ file: ./Dockerfile - platforms: linux/amd64,linux/arm64,linux/arm/v7 + platforms: linux/amd64,linux/arm64 push: true tags: ${{ secrets.DOCKER_HUB_USERNAME }}/plex-meta-manager:nightly diff --git a/VERSION b/VERSION index df1cde6a..2113a522 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.1-develop24 +1.17.1-develop25 diff --git a/modules/library.py b/modules/library.py index 13a02680..048158d0 100644 --- a/modules/library.py +++ b/modules/library.py @@ -3,7 +3,7 @@ from abc import ABC, abstractmethod from modules import util, operations from modules.meta import MetadataFile, OverlayFile from modules.operations import Operations -from modules.util import Failed, YAML +from modules.util import Failed, NotScheduled, YAML logger = util.logger @@ -138,6 +138,9 @@ class Library(ABC): self.metadata_files.append(meta_obj) except Failed as e: logger.error(e) + except NotScheduled as e: + logger.info("") + logger.separator(f"Skipping {e} Metadata File") if not operations_only and not collection_only: for file_type, overlay_file, temp_vars, asset_directory in self.overlay_path: try: diff --git a/modules/meta.py b/modules/meta.py index 779c0963..77ce9b1e 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -1,7 +1,7 @@ import math, operator, os, re, requests from datetime import datetime -from modules import plex, ergast, overlay, util -from modules.util import Failed, YAML +from modules import plex, ergast, util +from modules.util import Failed, NotScheduled, YAML from plexapi.exceptions import NotFound, BadRequest logger = util.logger @@ -347,6 +347,9 @@ class DataFile: class MetadataFile(DataFile): def __init__(self, config, library, file_type, path, temp_vars, asset_directory): super().__init__(config, file_type, path, temp_vars, asset_directory) + metadata_name = self.get_file_name() + if config.requested_metadata_files and metadata_name not in config.requested_metadata_files: + raise NotScheduled(metadata_name) self.data_type = "Collection" self.library = library if file_type == "Data": diff --git a/plex_meta_manager.py b/plex_meta_manager.py index af56b447..48c6340c 100644 --- a/plex_meta_manager.py +++ b/plex_meta_manager.py @@ -246,7 +246,7 @@ def run_config(config, stats): playlist_status = {} playlist_stats = {} - if (config.playlist_files or config.general["playlist_report"]) and not overlays_only and not operations_only and not collection_only: + if (config.playlist_files or config.general["playlist_report"]) and not overlays_only and not operations_only and not collection_only and not config.requested_metadata_files: logger.add_playlists_handler() if config.playlist_files: playlist_status, playlist_stats = run_playlists(config) @@ -462,11 +462,15 @@ def run_libraries(config): library.map_guids(temp_items) library_status[library.name]["Library Loading and Mapping"] = str(datetime.now() - time_start).split('.')[0] - if config.library_first and not config.test_mode and not collection_only and not playlist_only: - if not overlays_only and library.library_operation: - library_status[library.name]["Library Operations"] = library.Operations.run_operations() - if not operations_only and (library.overlay_files or library.remove_overlays): - library_status[library.name]["Library Overlays"] = library.Overlays.run_overlays() + def run_operations_and_overlays(): + if not config.test_mode and not collection_only and not playlist_only and not config.requested_metadata_files: + if not overlays_only and library.library_operation: + library_status[library.name]["Library Operations"] = library.Operations.run_operations() + if not operations_only and (library.overlay_files or library.remove_overlays): + library_status[library.name]["Library Overlays"] = library.Overlays.run_overlays() + + if config.library_first: + run_operations_and_overlays() if not operations_only and not overlays_only and not playlist_only: time_start = datetime.now() @@ -497,11 +501,8 @@ def run_libraries(config): logger.re_add_library_handler(library.mapping_name) library_status[library.name]["Library Metadata Files"] = str(datetime.now() - time_start).split('.')[0] - if not config.library_first and not config.test_mode and not collection_only and not playlist_only: - if not overlays_only and library.library_operation: - library_status[library.name]["Library Operations"] = library.Operations.run_operations() - if not operations_only and (library.overlay_files or library.remove_overlays): - library_status[library.name]["Library Overlays"] = library.Overlays.run_overlays() + if not config.library_first: + run_operations_and_overlays() logger.remove_library_handler(library.mapping_name) except Exception as e: