This commit is contained in:
Yozora XCII 2024-04-30 13:06:53 +01:00
commit d6f1069d7f
3 changed files with 87 additions and 36 deletions

View file

@ -17,17 +17,9 @@ Special thanks to Magic815 for the overlay image inspiration and base template.
Please consider [donating](https://github.com/sponsors/meisnate12) towards the project.
## Collection Defaults
See the [Collection Defaults](collections.md) Page for more information on the specifics of the Collection Defaults.
## Overlay Defaults
See the [Overlay Defaults](overlays.md) Page for more information on the specifics of the Overlay Defaults.
## Configurations
To run a default KometCollection or Overlay file you can simply add it to your `collection_files` (For Collection Files)
To run a default Kometa Collection or Overlay file you can simply add it to your `collection_files` (For Collection Files)
or `overlay_files` (For Overlay Files) using `default` like so:
```yaml
@ -41,16 +33,60 @@ libraries:
- default: ratings
```
## Customizing Configs
## Customizing these defaults
Configs can be customized using the `template_variables` attribute when calling the file. These `template_variables`
will be given to every template call in the file which allows them to affect how that file runs.
Configs can be customized using the `template_variables` attribute when calling the file.
For collections, this example disables two keys, which will prevent those collections from being created. It also sets
the visibility of one of the keys so that it is visible on the library tab, the server owner's homescreen and shared
user's homescreens (assuming they server owner and/or the shared users have the library pinned to their homescreen)
These template variables can be used to customize individual collections/overlays or the set as a whole.
For overlays, this example changes the ratings overlay to apply to episodes rather than shows.
A given default may have variables that are specific to it, and may also leverage a common set of shared template variables. These lists are shown on each default file's wiki page.
## Customizing individual components
Each default file uses "keys" to refer to the collections and overlays that it creates, and you can use those keys to modify the behavior of individual collections or overlays created by the file.
For, example, the IMDB default creates three collections, each with their own "key":
| Collection | Key |
|:--------------------|:----------|
| `IMDb Popular` | `popular` |
| `IMDb Top 250` | `top` |
| `IMDb Lowest Rated` | `lowest` |
You use that key to customize the individual collection or overlay.
This example disables two keys, which will prevent those collections from being created. It also sets
the visibility of one of the keys [`top`] so that it is visible on the library tab, the server owner's homescreen and shared
user's homescreens (assuming the server owner and/or the shared users have the library pinned to their homescreen)
It also changes the resolution overlay to skip applying the overlay to 480p movies.
The template variables in this example happen to be all shared template variables.
```yaml
libraries:
Movies:
collection_files:
- default: imdb
template_variables:
use_popular: false # turn off the 'popular' key
use_lowest: false # turn off the 'lowest' key
visible_library_top: true # set visibilities for the 'top' key
visible_home_top: true
visible_shared_top: true
overlay_files:
- default: resolution
template_variables:
use_480p: false # turn off the '480p' key
```
## Customizing the set as a whole
In addition to the keys, each default can be customized with other template variables that are not key-specific.
This example uses a file-specific variable to change the order of all the IMDB chart collections to alphabetical by title and a shared variable to schedule these IMDB collections to be run only on Wednesdays.
On the `resolution` overlay, it uses a file-specific variable to disable all the "edition" overlays and a shared variable to align the overlay on the right side of the poster.
```yaml
libraries:
@ -63,17 +99,33 @@ libraries:
visible_library_top: true
visible_home_top: true
visible_shared_top: true
collection_order: alpha # file-specific variable sets sort order
schedule: weekly(wednesday) # shared variable sets schedule
overlay_files:
- default: ratings
- default: ribbon
template_variables:
builder_level: episode
use_480p: false
use_edition: false # file-specific variable hides editions
horizontal_align: right # shared variable sets alignment
```
Each file has a page on the wiki showing the available `template_variables` for each file. For example the default
`default: ratings` has a page [here](overlays/ratings.md).
All of the default files are customized in this basic fashion.
**In addition to the defined `template_variables` almost all default Collection and Overlay files have access to their
respective [Collection](collection_variables.md)/[Overlay](overlay_variables.md) Shared Variables.**
**NOTE: this `template_variable` system is specific to the defaults. If and when you start creating your own [collection](../files/collections.md) or [overlay](../files/overlays.md) files, you cannot use this `template_variables` setup unless you specifically write your files to implement it.**
Each of these default files has a page on the wiki showing its keys, available `template_variables`, and default settings. For example, the default overlay `default: resolution` has a page [here](overlays/resolution.md).
The shared template variables can be reviewed here for [Collections](collection_variables.md) and [Overlays](overlay_variables.md). These are also linked from each default file's wiki page. Keep in mind that *most*, but not all default files have access to the shared variables. This will be noted on the individual files' page.
## Collection Defaults
See the [Collection Defaults](collections.md) Page for more information on the specifics of the Collection Defaults.
## Overlay Defaults
See the [Overlay Defaults](overlays.md) Page for more information on the specifics of the Overlay Defaults.
# Example config using the defaults
{%
include-markdown "./example.md"

View file

@ -23,14 +23,14 @@ libraries:
### Example Poster Overlays
**Note: These examples use fonts not packaged with Kometa. See [bullmoose20's Configs](https://github.com/Kometa-Team/Community-Configs/tree/master/bullmoose20)**
![](images/movie-overlays1-annotated.png)
![](images/movie-overlays2-annotated.png)
<details>
<summary>Click to expand sample config.yml Movies overlays section:</summary>
**Note: This uses fonts not packaged with Kometa. See [bullmoose20's Configs](https://github.com/Kometa-Team/Community-Configs/tree/master/bullmoose20)**
```yaml
libraries:
Movies:
@ -74,8 +74,6 @@ libraries:
<details>
<summary>Click to expand sample config.yml TV Shows overlays section for the Show Poster:</summary>
**Note: This uses fonts not packaged with Kometa. See [bullmoose20's Configs](https://github.com/Kometa-Team/Community-Configs/tree/master/bullmoose20)**
```yaml
libraries:
TV Shows:
@ -141,8 +139,6 @@ libraries:
<details>
<summary>Click to expand sample config.yml TV Shows overlays section for the Episode Poster:</summary>
**Note: This uses fonts not packaged with Kometa. See [bullmoose20's Configs](https://github.com/Kometa-Team/Community-Configs/tree/master/bullmoose20)**
```yaml
libraries:
TV Shows:
@ -239,6 +235,10 @@ Each file has a page on the wiki showing the available `template_variables` for
**In addition to the defined `template_variables` almost all default Overlay files have access to the
[Shared Variables](collection_variables.md).**
### Custom fonts used in these examples:
See [bullmoose20's Configs](https://github.com/Kometa-Team/Community-Configs/tree/master/bullmoose20)
### Examples
{%

View file

@ -47,9 +47,8 @@ In addition, templates also have a few special attributes that they can use:
??? blank "`default` - Sets what template variables default to.<a class="headerlink" href="#default" title="Permanent link"></a>"
<div id="default" />The `default` attribute allows default values for template variables to be used if they're not
specified in the call. It's value is a dictionary of key value pairs where the key is the template variable and the
value is the default value to set it to when not provided.
<div id="default" />The `default` attribute allows default values for template variables which will be used if they're not
specified in the call. You need to provide a list of variables and the value that variable should get if not told differently when the template is referenced. See the tooltips below.
**A variable cannot be default if it is a conditional variable.**
@ -83,13 +82,13 @@ In addition, templates also have a few special attributes that they can use:
1. This sets the default value of the template variable `my_sync_mode` to `sync`.
2. The value for template variable `my_sync_mode` will replace `<<my_sync_mode>>` here.
3. This specifiys that `my_sync_mode` for this definition will be `append`.
3. This specifies that `my_sync_mode` for this definition will be `append`.
4. Since `my_sync_mode` is not passed to this definition the value of `my_sync_mode` will be the default `sync`.
??? blank "`optional` - List of template variables to be removed when not provided.<a class="headerlink" href="#optional" title="Permanent link"></a>"
<div id="optional" />The `optional` attribute can specify variables that when not specified on the template call
will cause any attribute using one of those variables to be ignored in the template. It's value is a list of
will cause any attribute using one of those variables to be ignored in the template. Its value is a list of
template variables to be considered optional.
**You can make any template variable optional per collection by setting it to `null`.**
@ -126,7 +125,7 @@ In addition, templates also have a few special attributes that they can use:
1. This sets the template variable `my_sync_mode` as an optional variable.
2. The value for template variable `my_sync_mode` will replace `<<my_sync_mode>>` here or removed as optional.
3. This specifiys that `my_sync_mode` for this definition will be `append`.
3. This specifies that `my_sync_mode` for this definition will be `append`.
4. Since `my_sync_mode` is not passed to this definition it will ignore the entire `sync_mode` attribute in the
template.
@ -145,7 +144,7 @@ In addition, templates also have a few special attributes that they can use:
A condition block consists of one or more key value pairs comparing given template variables to pre supplied static
values.
The key is the name of the template variable who's value you want to compare. While the value is the staic value or
The key is the name of the template variable whose value you want to compare, while the value is the static value or
values to compare aginst. Every condition block must also have the `value` key which will be the value of the
template variable if all the conditions in that block are met.
@ -231,7 +230,7 @@ In addition, templates also have a few special attributes that they can use:
name: Movies
tmdb_id: 86311
Iron Man:
template:
1 template:
name: Movies
tmdb_id: 131292
```