[114] Image set prep

This commit is contained in:
meisnate12 2023-03-02 17:01:30 -05:00
parent 5d2aeb770b
commit bf5e9fceb5
5 changed files with 34 additions and 7 deletions

View file

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

View file

@ -927,8 +927,8 @@ class ConfigFile:
logger.info("")
logger.separator("Scanning Metadata and Overlay Files", space=False, border=False)
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:
raise Failed("Config Error: No valid metadata files, overlay files, playlist files, or library operations found")
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, images files, playlist files, or library operations found")
except Failed as e:
logger.stacktrace()
logger.error(e)

View file

@ -4,7 +4,7 @@ from modules import util, operations
from modules.meta import MetadataFile, OverlayFile
from modules.operations import Operations
from modules.util import Failed, NotScheduled, YAML
from PIL import Image, ImageFilter
from PIL import Image
logger = util.logger
@ -23,6 +23,7 @@ class Library(ABC):
self.queue_current = 0
self.metadata_files = []
self.overlay_files = []
self.images_files = []
self.movie_map = {}
self.show_map = {}
self.imdb_map = {}
@ -39,6 +40,7 @@ class Library(ABC):
self.original_mapping_name = params["mapping_name"]
self.metadata_path = params["metadata_path"]
self.overlay_path = params["overlay_path"]
self.images_path = params["images_path"]
self.skip_library = params["skip_library"]
self.asset_depth = params["asset_depth"]
self.asset_directory = params["asset_directory"] if params["asset_directory"] else []
@ -145,7 +147,7 @@ class Library(ABC):
self.metadata_files.append(meta_obj)
except Failed as e:
logger.error(e)
logger.info(f"Metadata File Failed To Load")
logger.info("Metadata File Failed To Load")
except NotScheduled as e:
logger.info("")
logger.separator(f"Skipping {e} Metadata File")
@ -159,7 +161,15 @@ class Library(ABC):
self.queue_current += 1
except Failed as 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):
poster_uploaded = False

View file

@ -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})
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)
self.image_set_file = image_set_file
metadata_name = self.get_file_name()
if config.requested_metadata_files and metadata_name not in config.requested_metadata_files:
raise NotScheduled(metadata_name)

View file

@ -576,6 +576,22 @@ def run_libraries(config):
run_operations_and_overlays()
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()
for metadata in library.metadata_files:
metadata_name = metadata.get_file_name()