mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 06:54:21 +00:00
[7] more overlay tweaks
This commit is contained in:
parent
1d06d5c4df
commit
de645d905a
4 changed files with 40 additions and 38 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.16.5-develop6
|
||||
1.16.5-develop7
|
||||
|
|
|
@ -781,11 +781,11 @@ class ConfigFile:
|
|||
continue
|
||||
|
||||
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()
|
||||
if not library.metadata_files and not library.library_operation and not self.playlist_files:
|
||||
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
|
||||
|
||||
if self.general["radarr"]["url"] or (lib and "radarr" in lib):
|
||||
|
|
|
@ -24,40 +24,47 @@ class Overlays:
|
|||
overlay_updated = {}
|
||||
overlay_images = {}
|
||||
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 k, v in overlay_file.overlays.items():
|
||||
builder = CollectionBuilder(self.config, overlay_file, k, v, library=self.library, overlay=True)
|
||||
logger.info("")
|
||||
|
||||
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:
|
||||
try:
|
||||
builder = CollectionBuilder(self.config, overlay_file, k, v, library=self.library, overlay=True)
|
||||
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("")
|
||||
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)
|
||||
logger.separator(f"Gathering Items for {k} Overlay", space=False, border=False)
|
||||
|
||||
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)
|
||||
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("")
|
||||
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():
|
||||
clean_name, _ = util.validate_filename(overlay_name)
|
||||
|
@ -99,11 +106,6 @@ class Overlays:
|
|||
elif self.library.is_music:
|
||||
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):
|
||||
logger.ghost(f"Restoring: {i}/{len(remove_overlays)} {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 not overlays_only and library.library_operation:
|
||||
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()
|
||||
|
||||
logger.debug("")
|
||||
|
|
Loading…
Reference in a new issue