[7] more overlay tweaks

pull/858/head
meisnate12 3 years ago
parent 1d06d5c4df
commit de645d905a

@ -1 +1 @@
1.16.5-develop6 1.16.5-develop7

@ -781,11 +781,11 @@ class ConfigFile:
continue continue
logger.info("") logger.info("")
logger.separator("Scanning Metadata Files", space=False, border=False) logger.separator("Scanning Metadata and Overlay Files", space=False, border=False)
library.scan_files() library.scan_files()
if not library.metadata_files and not library.library_operation and not self.playlist_files: if not library.metadata_files and not library.library_operation and not self.playlist_files:
logger.info("") logger.info("")
logger.error("Config Error: No valid metadata files, playlist files, or library operations found") logger.error("Config Error: No valid metadata files, overlay files, playlist files, or library operations found")
continue continue
if self.general["radarr"]["url"] or (lib and "radarr" in lib): if self.general["radarr"]["url"] or (lib and "radarr" in lib):

@ -24,40 +24,47 @@ class Overlays:
overlay_updated = {} overlay_updated = {}
overlay_images = {} overlay_images = {}
item_overlays = {} item_overlays = {}
if not self.library.remove_overlays: if self.library.remove_overlays:
logger.info("")
logger.separator(f"Removing Overlays for the {self.library.name} Library")
logger.info("")
else:
for overlay_file in self.library.overlay_files: for overlay_file in self.library.overlay_files:
for k, v in overlay_file.overlays.items(): for k, v in overlay_file.overlays.items():
builder = CollectionBuilder(self.config, overlay_file, k, v, library=self.library, overlay=True) try:
logger.info("") builder = CollectionBuilder(self.config, overlay_file, k, v, library=self.library, overlay=True)
logger.separator(f"Gathering Items for {k} Overlay", space=False, border=False)
if builder.overlay not in overlay_rating_keys:
overlay_rating_keys[builder.overlay] = []
if builder.filters or builder.tmdb_filters:
logger.info("")
for filter_key, filter_value in builder.filters:
logger.info(f"Collection Filter {filter_key}: {filter_value}")
for filter_key, filter_value in builder.tmdb_filters:
logger.info(f"Collection Filter {filter_key}: {filter_value}")
for method, value in builder.builders:
logger.debug("")
logger.debug(f"Builder: {method}: {value}")
logger.info("") logger.info("")
builder.filter_and_save_items(builder.gather_ids(method, value))
if builder.added_items: logger.separator(f"Gathering Items for {k} Overlay", space=False, border=False)
for item in builder.added_items:
item_keys[item.ratingKey] = item if builder.overlay not in overlay_rating_keys:
if item.ratingKey not in overlay_rating_keys[builder.overlay]: overlay_rating_keys[builder.overlay] = []
overlay_rating_keys[builder.overlay].append(item.ratingKey)
if builder.filters or builder.tmdb_filters:
if builder.remove_overlays: logger.info("")
for rk in overlay_rating_keys[builder.overlay]: for filter_key, filter_value in builder.filters:
for remove_overlay in builder.remove_overlays: logger.info(f"Collection Filter {filter_key}: {filter_value}")
if remove_overlay in overlay_rating_keys and rk in overlay_rating_keys[remove_overlay]: for filter_key, filter_value in builder.tmdb_filters:
overlay_rating_keys[remove_overlay].remove(rk) logger.info(f"Collection Filter {filter_key}: {filter_value}")
for method, value in builder.builders:
logger.debug("")
logger.debug(f"Builder: {method}: {value}")
logger.info("")
builder.filter_and_save_items(builder.gather_ids(method, value))
if builder.added_items:
for item in builder.added_items:
item_keys[item.ratingKey] = item
if item.ratingKey not in overlay_rating_keys[builder.overlay]:
overlay_rating_keys[builder.overlay].append(item.ratingKey)
if builder.remove_overlays:
for rk in overlay_rating_keys[builder.overlay]:
for remove_overlay in builder.remove_overlays:
if remove_overlay in overlay_rating_keys and rk in overlay_rating_keys[remove_overlay]:
overlay_rating_keys[remove_overlay].remove(rk)
except Failed as e:
logger.error(e)
for overlay_name, over_keys in overlay_rating_keys.items(): for overlay_name, over_keys in overlay_rating_keys.items():
clean_name, _ = util.validate_filename(overlay_name) clean_name, _ = util.validate_filename(overlay_name)
@ -99,11 +106,6 @@ class Overlays:
elif self.library.is_music: elif self.library.is_music:
remove_overlays.extend(get_overlay_items(libtype="album")) remove_overlays.extend(get_overlay_items(libtype="album"))
if remove_overlays:
logger.info("")
logger.separator(f"Removing Overlays for the {self.library.name} Library")
logger.info("")
for i, item in enumerate(remove_overlays, 1): for i, item in enumerate(remove_overlays, 1):
logger.ghost(f"Restoring: {i}/{len(remove_overlays)} {item.title}") logger.ghost(f"Restoring: {i}/{len(remove_overlays)} {item.title}")
clean_name, _ = util.validate_filename(item.title) clean_name, _ = util.validate_filename(item.title)

@ -223,7 +223,7 @@ def update_libraries(config):
if config.library_first and not config.test_mode and not collection_only: if config.library_first and not config.test_mode and not collection_only:
if not overlays_only and library.library_operation: if not overlays_only and library.library_operation:
library.Operations.run_operations() library.Operations.run_operations()
if not operations_only and library.overlay_files or library.remove_overlays: if not operations_only and (library.overlay_files or library.remove_overlays):
library.Overlays.run_overlays() library.Overlays.run_overlays()
logger.debug("") logger.debug("")

Loading…
Cancel
Save