[114] Image set prep

pull/1331/head^2
meisnate12 2 years ago
parent 5d2aeb770b
commit bf5e9fceb5

@ -1 +1 @@
1.18.3-develop113 1.18.3-develop114

@ -927,8 +927,8 @@ class ConfigFile:
logger.info("") logger.info("")
logger.separator("Scanning Metadata and Overlay Files", space=False, border=False) logger.separator("Scanning Metadata and Overlay Files", space=False, border=False)
library.scan_files(self.operations_only, self.overlays_only, self.collection_only) library.scan_files(self.operations_only, self.overlays_only, self.collection_only)
if not library.metadata_files and not library.overlay_files and not library.library_operation and not self.playlist_files: if not library.metadata_files and not library.overlay_files and not library.library_operation and not library.images_files and not self.playlist_files:
raise Failed("Config Error: No valid metadata files, overlay files, playlist files, or library operations found") raise Failed("Config Error: No valid metadata files, overlay files, images files, playlist files, or library operations found")
except Failed as e: except Failed as e:
logger.stacktrace() logger.stacktrace()
logger.error(e) logger.error(e)

@ -4,7 +4,7 @@ from modules import util, operations
from modules.meta import MetadataFile, OverlayFile from modules.meta import MetadataFile, OverlayFile
from modules.operations import Operations from modules.operations import Operations
from modules.util import Failed, NotScheduled, YAML from modules.util import Failed, NotScheduled, YAML
from PIL import Image, ImageFilter from PIL import Image
logger = util.logger logger = util.logger
@ -23,6 +23,7 @@ class Library(ABC):
self.queue_current = 0 self.queue_current = 0
self.metadata_files = [] self.metadata_files = []
self.overlay_files = [] self.overlay_files = []
self.images_files = []
self.movie_map = {} self.movie_map = {}
self.show_map = {} self.show_map = {}
self.imdb_map = {} self.imdb_map = {}
@ -39,6 +40,7 @@ class Library(ABC):
self.original_mapping_name = params["mapping_name"] self.original_mapping_name = params["mapping_name"]
self.metadata_path = params["metadata_path"] self.metadata_path = params["metadata_path"]
self.overlay_path = params["overlay_path"] self.overlay_path = params["overlay_path"]
self.images_path = params["images_path"]
self.skip_library = params["skip_library"] self.skip_library = params["skip_library"]
self.asset_depth = params["asset_depth"] self.asset_depth = params["asset_depth"]
self.asset_directory = params["asset_directory"] if params["asset_directory"] else [] self.asset_directory = params["asset_directory"] if params["asset_directory"] else []
@ -145,7 +147,7 @@ class Library(ABC):
self.metadata_files.append(meta_obj) self.metadata_files.append(meta_obj)
except Failed as e: except Failed as e:
logger.error(e) logger.error(e)
logger.info(f"Metadata File Failed To Load") logger.info("Metadata File Failed To Load")
except NotScheduled as e: except NotScheduled as e:
logger.info("") logger.info("")
logger.separator(f"Skipping {e} Metadata File") logger.separator(f"Skipping {e} Metadata File")
@ -159,7 +161,15 @@ class Library(ABC):
self.queue_current += 1 self.queue_current += 1
except Failed as e: except Failed as e:
logger.error(e) logger.error(e)
logger.info(f"Overlay File Failed To Load") logger.info("Overlay File Failed To Load")
if not operations_only and not overlays_only:
for file_type, images_file, temp_vars, asset_directory in self.images_path:
try:
images_obj = MetadataFile(self.config, self, file_type, images_file, temp_vars, asset_directory, image_set_file=True)
self.images_files.append(images_obj)
except Failed as e:
logger.error(e)
logger.info("Images File Failed To Load")
def upload_images(self, item, poster=None, background=None, overlay=False): def upload_images(self, item, poster=None, background=None, overlay=False):
poster_uploaded = False poster_uploaded = False

@ -587,8 +587,9 @@ class DataFile:
self.translation_variables.update({k: v for k, v in variables.items() if k not in self.translation_variables}) self.translation_variables.update({k: v for k, v in variables.items() if k not in self.translation_variables})
class MetadataFile(DataFile): class MetadataFile(DataFile):
def __init__(self, config, library, file_type, path, temp_vars, asset_directory): def __init__(self, config, library, file_type, path, temp_vars, asset_directory, image_set_file=False):
super().__init__(config, file_type, path, temp_vars, asset_directory) super().__init__(config, file_type, path, temp_vars, asset_directory)
self.image_set_file = image_set_file
metadata_name = self.get_file_name() metadata_name = self.get_file_name()
if config.requested_metadata_files and metadata_name not in config.requested_metadata_files: if config.requested_metadata_files and metadata_name not in config.requested_metadata_files:
raise NotScheduled(metadata_name) raise NotScheduled(metadata_name)

@ -576,6 +576,22 @@ def run_libraries(config):
run_operations_and_overlays() run_operations_and_overlays()
if not operations_only and not overlays_only and not playlist_only: if not operations_only and not overlays_only and not playlist_only:
time_start = datetime.now()
for images in library.images_files:
images_name = images.get_file_name()
if config.requested_metadata_files and images_name not in config.requested_metadata_files:
logger.info("")
logger.separator(f"Skipping {images_name} Images File")
continue
logger.info("")
logger.separator(f"Running {images_name} Images File\n{images.path}")
if not test and not resume and not collection_only:
try:
images.update_metadata()
except Failed as e:
library.notify(e)
logger.error(e)
time_start = datetime.now() time_start = datetime.now()
for metadata in library.metadata_files: for metadata in library.metadata_files:
metadata_name = metadata.get_file_name() metadata_name = metadata.get_file_name()

Loading…
Cancel
Save