From 47d5e96ab6a33431f4242d7c9ca448fdec7fff28 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Thu, 28 Jul 2022 11:03:50 -0400 Subject: [PATCH] [15] fix special text overlays --- VERSION | 2 +- docs/metadata/overlay.md | 4 ++-- modules/overlay.py | 4 ++-- modules/overlays.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index 9c58b95a..c48b6951 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.2-develop14 +1.17.2-develop15 diff --git a/docs/metadata/overlay.md b/docs/metadata/overlay.md index c88e0b9c..d726f437 100644 --- a/docs/metadata/overlay.md +++ b/docs/metadata/overlay.md @@ -171,7 +171,7 @@ overlays: #### Special Text Variables -You can use the item's metadata to determine the text by adding Special Text Variables to you text Overlay. +You can use the item's metadata to determine the text by adding Special Text Variables to your text Overlay. There are multiple Special Text Variables that can be used when formatting the text. The variables are defined like so `<>` and some can have modifiers like so `<>` where `$` is the modifier. The available options are: @@ -235,6 +235,7 @@ overlays: ``` ##### Common Special Text Uses + These are some commonly-used examples of Special Text overlays: | Special Text | Example Output | @@ -246,7 +247,6 @@ These are some commonly-used examples of Special Text overlays: | `name: text(Runtime: <>m)` | Runtime: 90m | | `name: text(Runtime: <>h <>m)` | Runtime: 1h 30m | - #### Text Addon Images You can add an image to accompany the text by specifying the image location using `file`, `url`, `git`, or `repo`. diff --git a/modules/overlay.py b/modules/overlay.py index 2ae7bcc9..b0e33414 100644 --- a/modules/overlay.py +++ b/modules/overlay.py @@ -8,7 +8,7 @@ logger = util.logger portrait_dim = (1000, 1500) landscape_dim = (1920, 1080) -old_special_text2 = [f"{a}{s}" for a in ["audience_rating", "critic_rating", "user_rating"] for s in ["", "0", "%", "#"]] +old_special_text = [f"{a}{s}" for a in ["audience_rating", "critic_rating", "user_rating"] for s in ["", "0", "%", "#"]] float_vars = ["audience_rating", "critic_rating", "user_rating"] int_vars = ["runtime", "season_number", "episode_number", "episode_count"] date_vars = ["originally_available"] @@ -281,7 +281,7 @@ class Overlay: self.font_color = ImageColor.getcolor(self.data["font_color"], "RGBA") except ValueError: raise Failed(f"Overlay Error: overlay font_color: {self.data['font_color']} invalid") - if text in old_special_text2: + if text in old_special_text: text_mod = text[-1] if text[-1] in ["0", "%", "#"] else None text = text if text_mod is None else text[:-1] self.name = f"text(<<{text}#>>)" if text_mod == "#" else f"text(<<{text}%>>{'' if text_mod == '0' else '%'})" diff --git a/modules/overlays.py b/modules/overlays.py index 920a4719..a3cbd700 100644 --- a/modules/overlays.py +++ b/modules/overlays.py @@ -265,7 +265,7 @@ class Overlays: for over_name in applied_names: current_overlay = properties[over_name] if current_overlay.name.startswith("text"): - if current_overlay.name == "text(special_text)": + if "<<" in current_overlay.name: image_box = current_overlay.image.size if current_overlay.image else None try: overlay_image, addon_box = current_overlay.get_backdrop((canvas_width, canvas_height), box=image_box, text=get_text(current_overlay))