From 71d5e8185854eaf6fb3ce15b9e2a992927664be9 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Fri, 28 Oct 2022 16:48:15 -0400 Subject: [PATCH] [169] update queues --- VERSION | 2 +- defaults/overlays/languages.yml | 23 ++++++++++++++--------- docs/defaults/overlays/languages.md | 8 +++++--- modules/config.py | 1 + modules/library.py | 2 ++ modules/meta.py | 23 +++++++++++------------ modules/overlay.py | 11 +++++++++-- 7 files changed, 43 insertions(+), 27 deletions(-) diff --git a/VERSION b/VERSION index 5c386d98..78bbcb84 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.3-develop168 +1.17.3-develop169 diff --git a/defaults/overlays/languages.yml b/defaults/overlays/languages.yml index 0b6103bd..fabb20e2 100644 --- a/defaults/overlays/languages.yml +++ b/defaults/overlays/languages.yml @@ -30,41 +30,46 @@ external_templates: value: 26 - style: square value: + queue: + default: audio_flags + conditions: + - use_subtitles: true + value: subtitle_flags default: style: round country: <> country_<>: <> offset: 10 - queue: position pmm: flag/<>/<>>> addon_position: <> addon_offset: <> back_color: "#00000099" back_width: 190 - back_radius: <> back_align: <> font: fonts/Inter-Bold.ttf font_size: 50 final_name: text(<>) queues: - position: + audio_flags: &pos_data + default: vertical_align: top horizontal_offset: 15 vertical_offset: 15 left: - horizontal_align: left - - vertical_offset: 75 + - vertical_offset: 76 - vertical_offset: 137 - - vertical_offset: 199 - - vertical_offset: 261 + - vertical_offset: 198 + - vertical_offset: 259 right: - horizontal_align: right - - vertical_offset: 75 + - vertical_offset: 76 - vertical_offset: 137 - - vertical_offset: 199 - - vertical_offset: 261 + - vertical_offset: 198 + - vertical_offset: 259 + subtitle_flags: *pos_data templates: flags: diff --git a/docs/defaults/overlays/languages.md b/docs/defaults/overlays/languages.md index 01848338..50141acf 100644 --- a/docs/defaults/overlays/languages.md +++ b/docs/defaults/overlays/languages.md @@ -118,19 +118,21 @@ All [Shared Overlay Variables](variables) are available with the default values |:--------------------|:---------------------------:| | `horizontal_offset` | `15` | | `horizontal_align` | `left`/`right` | -| `vertical_offset` | `15`/`75`/`135`/`195`/`255` | +| `vertical_offset` | `15`/`76`/`137`/`198`/`259` | | `vertical_align` | `top` | | `back_color` | `#00000099` | | `back_radius` | `26`/` ` | | `back_width` | `190` | | `back_height` | `105` | -| `back_align` | `left` | +| `back_align` | `left`/`right` | | `font` | `fonts/Inter-Bold.ttf` | | `font_size` | `50` | | Variable | Description & Values | |:------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `position` | **Description:** Changes the position of the Overlays.
**Default:** `left`
**Values:** `left`, `right`, `half`, or List of Coordinates | +| `position` | **Description:** Changes the position of all Overlay Queues in this File.
**Default:** `left`
**Values:** `left`, `right`, `half`, or List of Coordinates | +| `position_audio_flags` | **Description:** Changes the position of the audio flags Overlays.
**Default:** `left`
**Values:** `left`, `right`, `half`, or List of Coordinates | +| `position_subtitle_flags` | **Description:** Changes the position of the subtitle flags Overlays.
**Default:** `left`
**Values:** `left`, `right`, `half`, or List of Coordinates | | `style` | **Description:** Controls the visual theme of the overlays created.
Values:
roundRound Theme
squareSquare Theme
halfSquare Flag with Round Background
| | `offset` | **Description:** Controls the offset between the flag and the text.
**Default:** `10`
**Values:** Any Integer 0 or greater | | `align` | **Description:** Controls the flag alignment in the backdrop.
**Default:** `left`
**Values:** `left` or `right` | diff --git a/modules/config.py b/modules/config.py index 9ca841af..b9e398dc 100644 --- a/modules/config.py +++ b/modules/config.py @@ -568,6 +568,7 @@ class ConfigFile: self.playlist_names.extend([p for p in playlist_obj.playlists]) self.playlist_files.append(playlist_obj) except Failed as e: + logger.info(f"Playlist File Failed To Load") logger.error(e) else: logger.warning("playlist_files attribute not found") diff --git a/modules/library.py b/modules/library.py index 527ca577..ac0717c0 100644 --- a/modules/library.py +++ b/modules/library.py @@ -142,6 +142,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") except NotScheduled as e: logger.info("") logger.separator(f"Skipping {e} Metadata File") @@ -153,6 +154,7 @@ class Library(ABC): self.queue_names.extend([q for q in overlay_obj.queues]) except Failed as e: logger.error(e) + logger.info(f"Overlay File Failed To Load") def upload_images(self, item, poster=None, background=None, overlay=False): poster_uploaded = False diff --git a/modules/meta.py b/modules/meta.py index b7f128b4..cafad07f 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -1506,23 +1506,22 @@ class OverlayFile(DataFile): data = self.load_file(self.type, self.path, overlay=True) self.overlays = get_dict("overlays", data) self.templates = get_dict("templates", data) - queues = get_dict("queues", data, library.queue_names) + queues = get_dict("queues", data) self.queues = {} + position = temp_vars["position"] if "position" in temp_vars and temp_vars["position"] else None for queue_name, queue in queues.items(): + queue_position = temp_vars[f"position_{queue_name}"] if f"position_{queue_name}" in temp_vars and temp_vars[f"position_{queue_name}"] else position + if queue_name in library.queue_names and not queue_position: + continue initial_queue = None - if isinstance(queue, list): + if queue_position and isinstance(queue_position, list): + initial_queue = queue_position + elif queue_position and isinstance(queue, dict) and queue_position in queue: + initial_queue = queue[queue_position] + elif isinstance(queue, list): initial_queue = queue - elif queue_name in temp_vars and temp_vars[queue_name] and isinstance(temp_vars[queue_name], list): - initial_queue = temp_vars[queue_name] - elif queue_name in temp_vars and temp_vars[queue_name] and temp_vars[queue_name] in queue: - initial_queue = queue[temp_vars[queue_name]] elif isinstance(queue, dict): - for dk, dv in queue.items(): - if dk != "default": - initial_queue = dv - break - if initial_queue is None: - raise Failed(f"Config Error: queue {queue_name} must be a list or dictionary") + initial_queue = next((v for k, v in queue.items() if k != "default"), None) if not isinstance(initial_queue, list): raise Failed(f"Config Error: queue {queue_name} must be a list") diff --git a/modules/overlay.py b/modules/overlay.py index b0d60b53..09a34cee 100644 --- a/modules/overlay.py +++ b/modules/overlay.py @@ -287,15 +287,22 @@ class Overlay: raise Failed(f"Overlay Error: failed to parse overlay text name: {self.name}") self.name = f"text({match.group(1)})" text = f"{match.group(1)}" - self.font_name = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "fonts", "Roboto-Medium.ttf") + code_base = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + font_base = os.path.join(code_base, "fonts") + self.font_name = os.path.join(font_base, "Roboto-Medium.ttf") if "font_size" in self.data: self.font_size = util.parse("Overlay", "font_size", self.data["font_size"], datatype="int", parent="overlay", default=self.font_size) if "font" in self.data and self.data["font"]: font = str(self.data["font"]) + if not os.path.exists(font) and os.path.exists(os.path.join(code_base, font)): + font = os.path.join(code_base, font) if not os.path.exists(font): - fonts = util.get_system_fonts() + pmm_fonts = os.listdir(font_base) + fonts = util.get_system_fonts() + pmm_fonts if font not in fonts: raise Failed(f"Overlay Error: font: {os.path.abspath(font)} not found. Options: {', '.join(fonts)}") + if font in pmm_fonts: + font = os.path.join(font_base, font) self.font_name = font self.font = ImageFont.truetype(self.font_name, self.font_size) if "font_style" in self.data and self.data["font_style"]: