mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 06:54:21 +00:00
[55] fix multiple overlay names
This commit is contained in:
parent
b1f355dba0
commit
2331cb107f
6 changed files with 19 additions and 9 deletions
|
@ -8,7 +8,6 @@ RUN echo "**** install system packages ****" \
|
|||
&& apt-get install -y gcc g++ libxml2-dev libxslt-dev libz-dev wget \
|
||||
&& wget -O /tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-"$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
|
||||
&& chmod +x /tini \
|
||||
&& apt-get install jpeg-dev zlib-dev \
|
||||
&& pip3 install --no-cache-dir --upgrade --requirement /requirements.txt \
|
||||
&& apt-get --purge autoremove wget gcc g++ libxml2-dev libxslt-dev libz-dev -y \
|
||||
&& apt-get clean \
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.17.0-develop54
|
||||
1.17.0-develop55
|
||||
|
|
|
@ -260,7 +260,7 @@ class CollectionBuilder:
|
|||
suppress = util.get_list(data[methods["suppress_overlays"]])
|
||||
else:
|
||||
logger.error(f"Overlay Error: suppress_overlays attribute is blank")
|
||||
self.overlay = Overlay(config, library, self.mapping_name, overlay_data, suppress)
|
||||
self.overlay = Overlay(config, library, overlay_data, suppress)
|
||||
|
||||
self.sync_to_users = None
|
||||
self.valid_users = []
|
||||
|
|
|
@ -145,7 +145,6 @@ class Library(ABC):
|
|||
for file_type, overlay_file, temp_vars, asset_directory in self.overlay_path:
|
||||
try:
|
||||
overlay_obj = OverlayFile(self.config, self, file_type, overlay_file, temp_vars, asset_directory)
|
||||
self.overlay_names.extend([p for p in overlay_obj.overlays])
|
||||
self.overlay_files.append(overlay_obj)
|
||||
self.queue_names.extend([q for q in overlay_obj.queues])
|
||||
except Failed as e:
|
||||
|
|
|
@ -1195,7 +1195,7 @@ class OverlayFile(DataFile):
|
|||
logger.info("")
|
||||
logger.info(f"Loading Overlay {file_type}: {path}")
|
||||
data = self.load_file(self.type, self.path)
|
||||
self.overlays = get_dict("overlays", data, library.overlay_names)
|
||||
self.overlays = get_dict("overlays", data)
|
||||
self.templates = get_dict("templates", data)
|
||||
self.queues = get_dict("queues", data, library.queue_names)
|
||||
self.external_templates(data)
|
||||
|
|
|
@ -902,10 +902,9 @@ def parse_cords(data, parent, required=False):
|
|||
|
||||
|
||||
class Overlay:
|
||||
def __init__(self, config, library, mapping_name, overlay_data, suppress):
|
||||
def __init__(self, config, library, overlay_data, suppress):
|
||||
self.config = config
|
||||
self.library = library
|
||||
self.mapping_name = mapping_name
|
||||
self.data = overlay_data
|
||||
self.suppress = suppress
|
||||
self.keys = []
|
||||
|
@ -932,7 +931,20 @@ class Overlay:
|
|||
if not isinstance(self.data, dict):
|
||||
self.data = {"name": str(self.data)}
|
||||
logger.warning(f"Overlay Warning: No overlay attribute using mapping name {self.data} as the overlay name")
|
||||
self.name = str(self.data["name"]) if "name" in self.data and self.data["name"] else self.mapping_name
|
||||
if "name" not in self.data or not self.data["name"]:
|
||||
raise Failed(f"Overlay Error: overlay must have the name attribute")
|
||||
self.name = str(self.data["name"])
|
||||
if self.name not in library.overlay_names:
|
||||
library.overlay_names.append(self.name)
|
||||
self.mapping_name = self.name
|
||||
else:
|
||||
name_count = 1
|
||||
test_name = f"{self.name} ({name_count})"
|
||||
while test_name in library.overlay_names:
|
||||
name_count += 1
|
||||
test_name = f"{self.name} ({name_count})"
|
||||
library.overlay_names.append(test_name)
|
||||
self.mapping_name = test_name
|
||||
|
||||
if "group" in self.data and self.data["group"]:
|
||||
self.group = str(self.data["group"])
|
||||
|
@ -1195,7 +1207,7 @@ class Overlay:
|
|||
return overlay_image, (main_x, main_y)
|
||||
|
||||
def get_overlay_compare(self):
|
||||
output = f"{self.mapping_name}|{self.name}"
|
||||
output = f"{self.name}"
|
||||
if self.group:
|
||||
output += f"{self.group}{self.weight}"
|
||||
if self.has_coordinates():
|
||||
|
|
Loading…
Reference in a new issue