Skip to content

Commit

Permalink
queue updates
Browse files Browse the repository at this point in the history
  • Loading branch information
meisnate12 committed Jan 22, 2025
1 parent 443bb91 commit 1a8baa9
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 22 deletions.
13 changes: 4 additions & 9 deletions defaults/overlays/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,8 @@ queues:
settings:
default:
group_alignment: vertical
#vertical_position: top3
#horizontal_position: left
conditionals:
vertical_align:
initial_vertical_align:
default: top
conditions:
- vertical_position: [center, center_top, center_bottom]
Expand All @@ -94,7 +92,7 @@ queues:
value: top
- overlay_level: episode
value: top
horizontal_align:
initial_horizontal_align:
default: left
conditions:
- horizontal_position: [center, center_left, center_right]
Expand Down Expand Up @@ -124,9 +122,6 @@ queues:
surround:
default: false
conditions:
#- group_alignment: vertical
# vertical_position: center
# value: true
- group_alignment: horizontal
horizontal_position: [center, center_left, center_right]
value: true
Expand Down Expand Up @@ -165,8 +160,8 @@ queues:
- horizontal_position: center
value: 0
dynamic_position:
vertical_align: <<vertical_align>>
horizontal_align: <<horizontal_align>>
initial_vertical_align: <<initial_vertical_align>>
initial_horizontal_align: <<initial_horizontal_align>>
initial_vertical_offset: <<initial_vertical_offset>>
initial_horizontal_offset: <<initial_horizontal_offset>>
vertical_spacing: <<vertical_spacing>>
Expand Down
2 changes: 2 additions & 0 deletions docs/defaults/overlays/languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ work. Any value not specified will use its default value if it has one if not it
| `weight_<<key>>`<sup>1</sup> | **Description:** Controls the weight of the Overlay. Higher numbers have priority.<br>**Values:** Any Number |
| `vertical_spacing` | **Description:** Controls the vertical spacing from one overlay in the queue to the next.<br>**Values:** Any Integer |
| `horizontal_spacing` | **Description:** Controls the vertical spacing from one overlay in the queue to the next.<br>**Values:** Any Integer |
| `initial_vertical_align` | **Description:** Controls the initial vertical align the queue starts from.<br>**Values:** `top`, `center`, or `bottom` |
| `initial_horizontal_align` | **Description:** Controls the initial horizontal align the queue starts from.<br>**Values:** `left`, `center`, or `right` |
| `initial_vertical_offset` | **Description:** Controls the initial vertical offset the queue starts from.<br>**Values:** Any Integer |
| `initial_horizontal_offset` | **Description:** Controls the initial horizontal offset the queue starts from.<br>**Values:** Any Integer |

Expand Down
61 changes: 56 additions & 5 deletions docs/files/overlays.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ Whenever I execute Kometa and the Movies library is run, MyOverlays.yml will run

Overlay Files can utilize the following top-level attributes

| Attribute | Description |
|:--------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------|
| [`templates`](templates.md) | contains definitions of templates that can be leveraged by multiple Overlays |
| Attribute | Description |
|:-------------------------------------|:-----------------------------------------------------------------------------------------------------------------------|
| [`templates`](templates.md) | contains definitions of templates that can be leveraged by multiple Overlays |
| [`external_templates`](templates.md) | contains [file blocks](../config/files.md) that point to external templates that can be leveraged by multiple overlays |
| [`overlays`](#overlay-attributes) | contains definitions of Overlays you wish to add to one or more libraries |
| [`overlays`](#overlay-attributes) | contains definitions of Overlays you wish to add to one or more libraries |

* Example Files can be found in the [Kometa Community Configs Repository](https://github.com/Kometa-Team/Community-Configs)

Expand Down Expand Up @@ -649,7 +649,7 @@ overlays:

Overlay queues are defined by the name given to the `queue` attribute. The overlay with the highest weight is put into the first queue position, then the second highest is placed in the second queue position and so on.

You can define the queue positions by using the `queues` attribute at the top level of an Overlay File. You can define as many positions as you want.
You can define the queue positions by using the `queues` attribute at the top level of an Overlay File. You can define as many positions as you want.

```yaml
queues:
Expand Down Expand Up @@ -692,6 +692,57 @@ overlays:
back_height: 105
```

To save space when using queues if one attribute is not defined then it will inherit that attribute from the queue before it.

```yaml
queues:
custom_queue_name:
- horizontal_offset: 300 # This is the first position
horizontal_align: center
vertical_offset: 1375
vertical_align: top
- vertical_offset: 1250 # This is the second position
- vertical_offset: 1125 # This is the third position
```

### Dynamic Queues

Dynamic Queues build queues based on a set of values. To make a dynamic queue instead of having a list under the queue name you use the settings attribute.

| `settings` Attributes | Description |
|:----------------------|:------------------------------------------------------------------------|
| `default` | Set [default variables](templates.md/#default). |
| `conditionals` | Set [conditional variables](templates.md/#conditionals). |
| `dynamic_position` | Dynamic Position Attributes |
| `overlay_limit` | Max number of overlays to use.<br>**Value:** Any Integer greater then 0 |

| `dynamic_position` Attributes | Description |
|:------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `initial_vertical_align` | Controls the initial Vertical Alignment of the overlay queue.<br>**Values:** `top`, `center`, or `bottom` |
| `initial_horizontal_align` | Controls the initial Horizontal Alignment of the overlay queue.<br>**Values:** `left`, `center`, or `right` |
| `initial_vertical_offset` | Controls the initial Vertical Offset of this overlay queue. Can be a %.<br>**Values:** Number 0 or greater or 0%-100% [pixels assuming a 1000x1500 image] |
| `initial_horizontal_offset` | Controls the initial Horizontal Offset of this overlay queue. Can be a %.<br>**Values:** Number 0 or greater or 0%-100% [pixels assuming a 1000x1500 image] |
| `vertical_spacing` | Controls the vertical spacing between different overlays in the queue.<br>**Values:** Number 0 or greater |
| `horizontal_spacing` | Controls the horizontal spacing between different overlays in the queue.<br>**Values:** Number 0 or greater |
| `surround` | Sets the queue so the second queue option is on one side of the original and then the next is on the opposite side.<br>**Values:** `true` to make the queue a surrounded queue. |

```yaml
queues:
flags:
settings:
dynamic_position:
initial_vertical_align: top
initial_horizontal_align: left
initial_vertical_offset: 15
initial_horizontal_offset: 15
vertical_spacing: 60
horizontal_spacing: 0
surround: false
overlay_limit: 3
```

* This will place 3 overlays with a different vertical offset of 15, 75, 135.

## Suppress Overlays

You can add `suppress_overlays` to an overlay definition and give it a list or comma separated string of overlay names you want suppressed from this item if this overlay is attached to the item.
Expand Down
14 changes: 11 additions & 3 deletions json-schema/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2208,9 +2208,15 @@
"font": { "type": "string" },
"git": { "type": "string" },
"group_alignment": { "type": "string", "enum": ["horizontal","vertical"] },
"hide_text": { "type": "boolean" },
"horizontal_align": { "type": "string", "enum": ["left","center","right"] },
"horizontal_offset": { "type": "integer", "minimum": 0 },
"horizontal_offset": { "type": "integer" },
"horizontal_position": { "type": "string", "enum": ["left","left2","center","center_left","center_right","right","right2"] },
"horizontal_spacing": { "type": "integer" },
"initial_horizontal_align": { "type": "string", "enum": ["left","center","right"] },
"initial_horizontal_offset": { "type": "integer" },
"initial_vertical_align": { "type": "string", "enum": ["top","center","bottom"] },
"initial_vertical_offset": { "type": "integer" },
"languages": { "type": "array", "uniqueItems": true, "items": {"type": "string", "pattern": "^[a-z]{2}$" }},
"last": { "type": "integer", "exclusiveMinimum": 0 },
"limit": { "type": "integer", "exclusiveMinimum": 0 },
Expand Down Expand Up @@ -2242,6 +2248,7 @@
"reapply_overlays": { "type": "boolean" },
"reset_overlays": { "type": "string", "enum": ["tmdb", "plex"] },
"repo": { "type": "string" },
"size": { "type": "string", "enum": ["small", "big"] },
"stroke_color": { "type": "string", "pattern": "^\\#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$" },
"stroke_width": { "type": "integer", "exclusiveMinimum": 0 },
"style": { "type": "string", "enum": ["compact","standard","bigger","round","square","half", "red", "black", "yellow", "gray", "color", "white"] },
Expand All @@ -2253,8 +2260,9 @@
"use_resolution": { "type": "boolean" },
"use_subtitles": { "type": "boolean" },
"vertical_align": { "type": "string", "enum": ["top","center","bottom"] },
"vertical_offset": { "type": "integer", "minimum": 0 },
"vertical_position": { "type": "string", "enum": ["top","top2","top3","center","center_top","center_bottom","bottom","bottom2","bottom3"] }
"vertical_offset": { "type": "integer" },
"vertical_position": { "type": "string", "enum": ["top","top2","top3","center","center_top","center_bottom","bottom","bottom2","bottom3"] },
"vertical_spacing": { "type": "integer" }
},
"patternProperties": {
"^country_.*$": { "type": "string", "pattern": "^[A-Z]{2}$" },
Expand Down
10 changes: 5 additions & 5 deletions modules/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -2326,7 +2326,7 @@ def __init__(self, config, library, file_type, path, temp_vars, asset_directory,
defaults[con_key] = con_value["default"]
if "dynamic_position" in queue["settings"] and queue["settings"]["dynamic_position"] and isinstance(queue["settings"]["dynamic_position"], dict):
dynamic_settings = {
"vertical_align": None, "horizontal_align": None, "surround": False,
"initial_vertical_align": None, "initial_horizontal_align": None, "surround": False,
"initial_vertical_offset": 0, "initial_horizontal_offset": 0, "vertical_spacing": 0, "horizontal_spacing": 0
}
for attr in dynamic_settings:
Expand All @@ -2339,17 +2339,17 @@ def __init__(self, config, library, file_type, path, temp_vars, asset_directory,
attr_value = attr_value.replace(f"<<{k}>>", str(v))
dynamic_settings[attr] = attr_value
dynamic_settings = {
"vertical_align": util.parse("Config", "vertical_align", dynamic_settings["vertical_align"], options=["top", "center", "bottom"], default="top"),
"horizontal_align": util.parse("Config", "horizontal_align", dynamic_settings["horizontal_align"], options=["left", "center", "right"], default="left"),
"initial_vertical_align": util.parse("Config", "initial_vertical_align", dynamic_settings["initial_vertical_align"], options=["top", "center", "bottom"], default="top"),
"initial_horizontal_align": util.parse("Config", "initial_horizontal_align", dynamic_settings["initial_horizontal_align"], options=["left", "center", "right"], default="left"),
"initial_vertical_offset": util.parse("Config", "initial_vertical_offset", dynamic_settings["initial_vertical_offset"], datatype="int", default=0, minimum=None),
"initial_horizontal_offset": util.parse("Config", "initial_horizontal_offset", dynamic_settings["initial_horizontal_offset"], datatype="int", default=0, minimum=None),
"vertical_spacing": util.parse("Config", "vertical_spacing", dynamic_settings["vertical_spacing"], datatype="int", default=0, minimum=None),
"horizontal_spacing": util.parse("Config", "horizontal_spacing", dynamic_settings["horizontal_spacing"], datatype="int", default=0, minimum=None),
"surround": util.parse("Config", "surround", dynamic_settings["surround"], datatype="bool", default=False)
}
queue_position = [{
"vertical_align": dynamic_settings["vertical_align"],
"horizontal_align": dynamic_settings["horizontal_align"],
"vertical_align": dynamic_settings["initial_vertical_align"],
"horizontal_align": dynamic_settings["initial_horizontal_align"],
"vertical_offset": dynamic_settings["initial_vertical_offset"],
"horizontal_offset": dynamic_settings["initial_horizontal_offset"]
}]
Expand Down

0 comments on commit 1a8baa9

Please sign in to comment.