mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 06:54:21 +00:00
[43] many small overlay fixes
This commit is contained in:
parent
7ad63b8eeb
commit
931e66caba
6 changed files with 29 additions and 30 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.16.5-develop42
|
||||
1.16.5-develop43
|
||||
|
|
|
@ -302,7 +302,7 @@ class CollectionBuilder:
|
|||
raise Failed(f"{self.Type} Error: overlay y_coordinate: {data[methods['overlay']]['y_coordinate']} invalid must be a number 0 or greater")
|
||||
if ("x_coordinate" in data[methods["overlay"]] or "y_coordinate" in data[methods["overlay"]]) and (x_coordinate is None or y_coordinate is None):
|
||||
raise Failed(f"{self.Type} Error: overlay x_coordinate and overlay y_coordinate must be used together")
|
||||
if x_coordinate or y_coordinate:
|
||||
if x_coordinate is not None or y_coordinate is not None:
|
||||
self.overlay_coordinates = (x_coordinate, y_coordinate)
|
||||
def get_and_save_image(image_url):
|
||||
response = self.config.get(image_url)
|
||||
|
@ -2629,7 +2629,7 @@ class CollectionBuilder:
|
|||
self.backgrounds["asset_directory"] = background_image
|
||||
except Failed as e:
|
||||
if self.library.asset_folders and (self.library.show_missing_assets or self.library.create_asset_folders):
|
||||
logger.error(e)
|
||||
logger.warning(e)
|
||||
|
||||
self.collection_poster = None
|
||||
if len(self.posters) > 0:
|
||||
|
|
|
@ -80,9 +80,9 @@ class ConfigFile:
|
|||
self.requested_libraries = util.get_list(attrs["libraries"]) if "libraries" in attrs else None
|
||||
self.requested_metadata_files = util.get_list(attrs["metadata_files"]) if "metadata_files" in attrs else None
|
||||
self.resume_from = attrs["resume"] if "resume" in attrs else None
|
||||
self.collection_only = attrs["collection_only"] if "collection_only" in attrs else None
|
||||
self.operations_only = attrs["operations_only"] if "operations_only" in attrs else None
|
||||
self.overlays_only = attrs["overlays_only"] if "overlays_only" in attrs else None
|
||||
self.collection_only = attrs["collection_only"] if "collection_only" in attrs else False
|
||||
self.operations_only = attrs["operations_only"] if "operations_only" in attrs else False
|
||||
self.overlays_only = attrs["overlays_only"] if "overlays_only" in attrs else False
|
||||
current_time = datetime.now()
|
||||
|
||||
yaml.YAML().allow_duplicate_keys = True
|
||||
|
@ -192,8 +192,6 @@ class ConfigFile:
|
|||
new_config["sonarr"] = temp
|
||||
if "trakt" in new_config: new_config["trakt"] = new_config.pop("trakt")
|
||||
if "mal" in new_config: new_config["mal"] = new_config.pop("mal")
|
||||
if not self.read_only:
|
||||
yaml.round_trip_dump(new_config, open(self.config_path, "w", encoding="utf-8"), block_seq_indent=2)
|
||||
self.data = new_config
|
||||
except yaml.scanner.ScannerError as e:
|
||||
logger.stacktrace()
|
||||
|
@ -490,7 +488,7 @@ class ConfigFile:
|
|||
default_playlist_file = os.path.abspath(os.path.join(self.default_dir, "playlists.yml"))
|
||||
logger.warning(f"Config Warning: playlist_files attribute is blank using default: {default_playlist_file}")
|
||||
paths_to_check = [default_playlist_file]
|
||||
files = util.load_files(paths_to_check, "playlist_files", (current_time, self.run_hour, self.ignore_schedules))
|
||||
files = util.load_files(paths_to_check, "playlist_files", schedule=(current_time, self.run_hour, self.ignore_schedules))
|
||||
if not files:
|
||||
raise Failed("Config Error: No Paths Found for playlist_files")
|
||||
for file_type, playlist_file, temp_vars, asset_directory in files:
|
||||
|
@ -732,7 +730,7 @@ class ConfigFile:
|
|||
if lib and "metadata_path" in lib:
|
||||
if not lib["metadata_path"]:
|
||||
raise Failed("Config Error: metadata_path attribute is blank")
|
||||
files = util.load_files(lib["metadata_path"], "metadata_path", (current_time, self.run_hour, self.ignore_schedules))
|
||||
files = util.load_files(lib["metadata_path"], "metadata_path", schedule=(current_time, self.run_hour, self.ignore_schedules))
|
||||
if not files:
|
||||
raise Failed("Config Error: No Paths Found for metadata_path")
|
||||
params["metadata_path"] = files
|
||||
|
@ -795,6 +793,12 @@ class ConfigFile:
|
|||
}
|
||||
library = Plex(self, params)
|
||||
logger.info(f"{display_name} Library Connection Successful")
|
||||
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)
|
||||
logger.info("")
|
||||
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")
|
||||
except Failed as e:
|
||||
logger.stacktrace()
|
||||
logger.error(e)
|
||||
|
@ -802,14 +806,6 @@ class ConfigFile:
|
|||
logger.info(f"{display_name} Library Connection Failed")
|
||||
continue
|
||||
|
||||
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.library_operation and not self.playlist_files:
|
||||
logger.info("")
|
||||
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):
|
||||
logger.info("")
|
||||
logger.separator("Radarr Configuration", space=False, border=False)
|
||||
|
|
|
@ -134,6 +134,8 @@ class DataFile:
|
|||
variables["collection_name"] = str(name)
|
||||
if self.data_type == "Playlist" and "playlist_name" not in variables:
|
||||
variables["playlist_name"] = str(name)
|
||||
if self.data_type == "Overlay" and "overlay_name" not in variables:
|
||||
variables["overlay_name"] = str(name)
|
||||
variables["library_type"] = self.library.type.lower()
|
||||
|
||||
for temp_key, temp_value in self.temp_vars.items():
|
||||
|
@ -266,7 +268,7 @@ class MetadataFile(DataFile):
|
|||
self.templates = get_dict("templates", path)
|
||||
else:
|
||||
logger.info("")
|
||||
logger.info(f"Loading Metadata {file_type}: {path}")
|
||||
logger.separator(f"Loading Metadata {file_type}: {path}")
|
||||
logger.info("")
|
||||
data = self.load_file(self.type, self.path)
|
||||
self.metadata = get_dict("metadata", data, library.metadatas)
|
||||
|
@ -275,9 +277,6 @@ class MetadataFile(DataFile):
|
|||
self.collections = get_dict("collections", data, library.collections)
|
||||
self.dynamic_collections = get_dict("dynamic_collections", data)
|
||||
col_names = library.collections + [c for c in self.collections]
|
||||
if self.dynamic_collections:
|
||||
logger.info("")
|
||||
logger.separator("Dynamic Collections")
|
||||
for map_name, dynamic in self.dynamic_collections.items():
|
||||
logger.info("")
|
||||
logger.separator(f"Building {map_name} Dynamic Collections", space=False, border=False)
|
||||
|
@ -547,7 +546,7 @@ class MetadataFile(DataFile):
|
|||
logger.debug(f"Other Name: {other_name}")
|
||||
logger.debug(f"Keys (Title)")
|
||||
for key, value in auto_list.items():
|
||||
logger.debug(f" - {key}{'' if key == value else f' ({value})'}")
|
||||
logger.info(f" - {key}{'' if key == value else f' ({value})'}")
|
||||
|
||||
used_keys = []
|
||||
for key, value in auto_list.items():
|
||||
|
@ -620,6 +619,7 @@ class MetadataFile(DataFile):
|
|||
|
||||
if not self.metadata and not self.collections:
|
||||
raise Failed("YAML Error: metadata, collections, or dynamic_collections attribute is required")
|
||||
logger.info("")
|
||||
logger.info(f"Metadata File Loaded Successfully")
|
||||
|
||||
def get_collections(self, requested_collections):
|
||||
|
|
|
@ -79,14 +79,16 @@ class Overlays:
|
|||
overlay_compare = [] if overlay_compare is None else util.get_list(overlay_compare, split="|")
|
||||
has_overlay = any([item_tag.tag.lower() == "overlay" for item_tag in item.labels])
|
||||
|
||||
compare_names = {f"{on}{properties[on]['coordinates']}" if properties[on]["coordinates"] else on: on for on in over_names}
|
||||
|
||||
overlay_change = False if has_overlay else True
|
||||
if not overlay_change:
|
||||
for oc in overlay_compare:
|
||||
if oc not in over_names:
|
||||
if oc not in compare_names:
|
||||
overlay_change = True
|
||||
if not overlay_change:
|
||||
for over_name in over_names:
|
||||
if over_name not in overlay_compare or properties[over_name]["updated"]:
|
||||
for over_name in compare_names:
|
||||
if over_name not in overlay_compare or properties[compare_names[over_name]]["updated"]:
|
||||
overlay_change = True
|
||||
try:
|
||||
poster, _, item_dir, _ = self.library.find_item_assets(item)
|
||||
|
@ -126,6 +128,7 @@ class Overlays:
|
|||
time.sleep(1)
|
||||
has_original = backup_image_path
|
||||
|
||||
|
||||
poster_compare = None
|
||||
if poster is None and has_original is None:
|
||||
logger.error(f"{item_title[:60]:<60} | Overlay Error: No poster found")
|
||||
|
@ -163,7 +166,7 @@ class Overlays:
|
|||
|
||||
if self.config.Cache and poster_compare:
|
||||
self.config.Cache.update_image_map(item.ratingKey, f"{self.library.image_table_name}_overlays",
|
||||
item.thumb, poster_compare, overlay='|'.join(over_names))
|
||||
item.thumb, poster_compare, overlay='|'.join(compare_names))
|
||||
except Failed as e:
|
||||
logger.error(e)
|
||||
logger.exorcise()
|
||||
|
|
|
@ -291,7 +291,7 @@ def time_window(tw):
|
|||
else:
|
||||
return tw
|
||||
|
||||
def load_files(files_to_load, method, file_type="yml", schedule=None):
|
||||
def load_files(files_to_load, method, schedule=None):
|
||||
files = []
|
||||
for file in get_list(files_to_load, split=False):
|
||||
if isinstance(file, dict):
|
||||
|
@ -320,11 +320,11 @@ def load_files(files_to_load, method, file_type="yml", schedule=None):
|
|||
elif not os.path.isdir(file["folder"]):
|
||||
logger.error(f"Config Error: Folder not found: {file['folder']}")
|
||||
else:
|
||||
yml_files = glob_filter(os.path.join(file["folder"], f"*.{file_type}"))
|
||||
yml_files = glob_filter(os.path.join(file["folder"], f"*.yml"))
|
||||
if yml_files:
|
||||
current.extend([("File", yml, temp_vars, asset_directory) for yml in yml_files])
|
||||
else:
|
||||
logger.error(f"Config Error: No {file_type.upper()} (.{file_type}) files found in {file['folder']}")
|
||||
logger.error(f"Config Error: No YAML (.yml) files found in {file['folder']}")
|
||||
|
||||
if schedule and "schedule" in file and file["schedule"]:
|
||||
current_time, run_hour, ignore_schedules = schedule
|
||||
|
|
Loading…
Reference in a new issue