[169] update queues

pull/1147/head
meisnate12 2 years ago
parent 32ee71ec8f
commit 71d5e81858

@ -1 +1 @@
1.17.3-develop168 1.17.3-develop169

@ -30,41 +30,46 @@ external_templates:
value: 26 value: 26
- style: square - style: square
value: value:
queue:
default: audio_flags
conditions:
- use_subtitles: true
value: subtitle_flags
default: default:
style: round style: round
country: <<key>> country: <<key>>
country_<<key>>: <<country>> country_<<key>>: <<country>>
offset: 10 offset: 10
queue: position
pmm: flag/<<final_style>>/<<country_<<key>>>> pmm: flag/<<final_style>>/<<country_<<key>>>>
addon_position: <<final_align>> addon_position: <<final_align>>
addon_offset: <<offset>> addon_offset: <<offset>>
back_color: "#00000099" back_color: "#00000099"
back_width: 190 back_width: 190
back_radius: <<back_radius>>
back_align: <<final_align>> back_align: <<final_align>>
font: fonts/Inter-Bold.ttf font: fonts/Inter-Bold.ttf
font_size: 50 font_size: 50
final_name: text(<<final_text>>) final_name: text(<<final_text>>)
queues: queues:
position: audio_flags: &pos_data
default: default:
vertical_align: top vertical_align: top
horizontal_offset: 15 horizontal_offset: 15
vertical_offset: 15 vertical_offset: 15
left: left:
- horizontal_align: left - horizontal_align: left
- vertical_offset: 75 - vertical_offset: 76
- vertical_offset: 137 - vertical_offset: 137
- vertical_offset: 199 - vertical_offset: 198
- vertical_offset: 261 - vertical_offset: 259
right: right:
- horizontal_align: right - horizontal_align: right
- vertical_offset: 75 - vertical_offset: 76
- vertical_offset: 137 - vertical_offset: 137
- vertical_offset: 199 - vertical_offset: 198
- vertical_offset: 261 - vertical_offset: 259
subtitle_flags: *pos_data
templates: templates:
flags: flags:

@ -118,19 +118,21 @@ All [Shared Overlay Variables](variables) are available with the default values
|:--------------------|:---------------------------:| |:--------------------|:---------------------------:|
| `horizontal_offset` | `15` | | `horizontal_offset` | `15` |
| `horizontal_align` | `left`/`right` | | `horizontal_align` | `left`/`right` |
| `vertical_offset` | `15`/`75`/`135`/`195`/`255` | | `vertical_offset` | `15`/`76`/`137`/`198`/`259` |
| `vertical_align` | `top` | | `vertical_align` | `top` |
| `back_color` | `#00000099` | | `back_color` | `#00000099` |
| `back_radius` | `26`/` ` | | `back_radius` | `26`/` ` |
| `back_width` | `190` | | `back_width` | `190` |
| `back_height` | `105` | | `back_height` | `105` |
| `back_align` | `left` | | `back_align` | `left`/`right` |
| `font` | `fonts/Inter-Bold.ttf` | | `font` | `fonts/Inter-Bold.ttf` |
| `font_size` | `50` | | `font_size` | `50` |
| Variable | Description & Values | | Variable | Description & Values |
|:------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |:------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `position` | **Description:** Changes the position of the Overlays.<br>**Default:** `left`<br>**Values:** `left`, `right`, `half`, or List of Coordinates | | `position` | **Description:** Changes the position of all Overlay Queues in this File.<br>**Default:** `left`<br>**Values:** `left`, `right`, `half`, or List of Coordinates |
| `position_audio_flags` | **Description:** Changes the position of the audio flags Overlays.<br>**Default:** `left`<br>**Values:** `left`, `right`, `half`, or List of Coordinates |
| `position_subtitle_flags` | **Description:** Changes the position of the subtitle flags Overlays.<br>**Default:** `left`<br>**Values:** `left`, `right`, `half`, or List of Coordinates |
| `style` | **Description:** Controls the visual theme of the overlays created.<table class="clearTable"><tr><th>Values:</th></tr><tr><td><code>round</code></td><td>Round Theme</td></tr><tr><td><code>square</code></td><td>Square Theme</td></tr><tr><td><code>half</code></td><td>Square Flag with Round Background</td></tr></table> | | `style` | **Description:** Controls the visual theme of the overlays created.<table class="clearTable"><tr><th>Values:</th></tr><tr><td><code>round</code></td><td>Round Theme</td></tr><tr><td><code>square</code></td><td>Square Theme</td></tr><tr><td><code>half</code></td><td>Square Flag with Round Background</td></tr></table> |
| `offset` | **Description:** Controls the offset between the flag and the text.<br>**Default:** `10`<br>**Values:** Any Integer 0 or greater | | `offset` | **Description:** Controls the offset between the flag and the text.<br>**Default:** `10`<br>**Values:** Any Integer 0 or greater |
| `align` | **Description:** Controls the flag alignment in the backdrop.<br>**Default:** `left`<br>**Values:** `left` or `right` | | `align` | **Description:** Controls the flag alignment in the backdrop.<br>**Default:** `left`<br>**Values:** `left` or `right` |

@ -568,6 +568,7 @@ class ConfigFile:
self.playlist_names.extend([p for p in playlist_obj.playlists]) self.playlist_names.extend([p for p in playlist_obj.playlists])
self.playlist_files.append(playlist_obj) self.playlist_files.append(playlist_obj)
except Failed as e: except Failed as e:
logger.info(f"Playlist File Failed To Load")
logger.error(e) logger.error(e)
else: else:
logger.warning("playlist_files attribute not found") logger.warning("playlist_files attribute not found")

@ -142,6 +142,7 @@ class Library(ABC):
self.metadata_files.append(meta_obj) self.metadata_files.append(meta_obj)
except Failed as e: except Failed as e:
logger.error(e) logger.error(e)
logger.info(f"Metadata File Failed To Load")
except NotScheduled as e: except NotScheduled as e:
logger.info("") logger.info("")
logger.separator(f"Skipping {e} Metadata File") 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]) self.queue_names.extend([q for q in overlay_obj.queues])
except Failed as e: except Failed as e:
logger.error(e) logger.error(e)
logger.info(f"Overlay File Failed To Load")
def upload_images(self, item, poster=None, background=None, overlay=False): def upload_images(self, item, poster=None, background=None, overlay=False):
poster_uploaded = False poster_uploaded = False

@ -1506,23 +1506,22 @@ class OverlayFile(DataFile):
data = self.load_file(self.type, self.path, overlay=True) data = self.load_file(self.type, self.path, overlay=True)
self.overlays = get_dict("overlays", data) self.overlays = get_dict("overlays", data)
self.templates = get_dict("templates", data) self.templates = get_dict("templates", data)
queues = get_dict("queues", data, library.queue_names) queues = get_dict("queues", data)
self.queues = {} self.queues = {}
position = temp_vars["position"] if "position" in temp_vars and temp_vars["position"] else None
for queue_name, queue in queues.items(): 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 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 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): elif isinstance(queue, dict):
for dk, dv in queue.items(): initial_queue = next((v for k, v in queue.items() if k != "default"), None)
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")
if not isinstance(initial_queue, list): if not isinstance(initial_queue, list):
raise Failed(f"Config Error: queue {queue_name} must be a list") raise Failed(f"Config Error: queue {queue_name} must be a list")

@ -287,15 +287,22 @@ class Overlay:
raise Failed(f"Overlay Error: failed to parse overlay text name: {self.name}") raise Failed(f"Overlay Error: failed to parse overlay text name: {self.name}")
self.name = f"text({match.group(1)})" self.name = f"text({match.group(1)})"
text = f"{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: 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) 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"]: if "font" in self.data and self.data["font"]:
font = str(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): 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: if font not in fonts:
raise Failed(f"Overlay Error: font: {os.path.abspath(font)} not found. Options: {', '.join(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_name = font
self.font = ImageFont.truetype(self.font_name, self.font_size) self.font = ImageFont.truetype(self.font_name, self.font_size)
if "font_style" in self.data and self.data["font_style"]: if "font_style" in self.data and self.data["font_style"]:

Loading…
Cancel
Save