diff --git a/CHANGELOG b/CHANGELOG index f02f0e750..bd06b3cba 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -28,6 +28,7 @@ Add `trakt` ratings source for mass episode operations. Added GitHub token validation during config validation. add `plex` ratings source for mass operations. Orderly error and no caching on too-large image +Allow `server_preroll` to accept a list # Docs Added "getting started" page diff --git a/VERSION b/VERSION index 728dba097..c6f3269be 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.0-build56 +2.1.0-build57 diff --git a/docs/files/settings.md b/docs/files/settings.md index a526937d5..8b1ae1390 100644 --- a/docs/files/settings.md +++ b/docs/files/settings.md @@ -46,43 +46,45 @@ tags: All the following attributes serve various functions as how the definition functions inside of Kometa. -| Attribute | Description & Values | -|:-----------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `name` | **Description:** Used to specify the name of the definition in Plex as different than the mapping name.
**Values:** Any String | -| `limit` | **Description:** Used to specify the max number of items for the definition
**Values:** Number greater than 0 | -| `template` | **Description:** Used to specify a template and template variables to use for this definition. See the [Templates Page](templates.md) for more information.
**Values:** Dictionary | -| `schedule` | **Description:** Used to specify the schedule when this definition will run.
**Default:** `daily`
**Values:** [Any Schedule Option](../config/schedule.md) | -| `run_again` | **Description:** Used to try and add all the missing items to the definition again after the daily run.
**Default:** `false`
**Values:** `true` or `false` | -| `sync_mode` | **Description:** Used to change how builders sync with this definition.
**Default:** `sync_mode` [settings value](../config/settings.md) in the Configuration File
**Values:** `sync` or `append`
See main [settings page](../config/settings.md#sync-mode) | -| `builder_level` | **Description:** Make season, episode, album or track collections/overlays from `plex_all`, `plex_search`, `trakt_list`, or `imdb_list` Builders and Filters
**Values:**
`season`Collection contains seasons
`episode`Collection contains episodes
`album`Collection contains albums
`track`Collection contains tracks
| -| `minimum_items` | **Description:** Minimum items that must be found to add to a definition.
**Default:** `minimum_items` [settings value](../config/settings.md) in the Configuration File
**Values:** number greater than 0 | -| `delete_below_minimum` | **Description:** Deletes the definition if below the minimum.
**Default:** `delete_below_minimum` [settings value](../config/settings.md) in the Configuration File
**Values:** `true` or `false` | -| `delete_not_scheduled` | **Description:** Deletes the definition if its skipped because its not scheduled.
**Default:** `delete_not_scheduled` [settings value](../config/settings.md) in the Configuration File
**Values:** `true` or `false` | -| `tmdb_region` | **Description:** Sets the region for `tmdb_popular`, `tmdb_now_playing`, `tmdb_top_rated`, and `tmdb_upcoming` | -| `validate_builders` | **Description:** When set to false the definition will not fail if one builder fails.
**Default:** `true`
**Values:** `true` or `false` | -| `cache_builders` | **Description:** Caches the items found by the builders for a number of days. This is useful if you run the same configuration on multiple libraries/servers in one run just set the value to `1`.
**Default:** `0`
**Values:** number 0 or greater | -| `blank_collection` | **Description:** When set to true the collection will be created with no builders and no items added.
**Default:** `false`
**Values:** `true` or `false` | -| `build_collection` | **Description:** When set to false the collection won't be created but items can still be added to Radarr/Sonarr. Does not work for playlists.
**Default:** `true`
**Values:** `true` or `false` | -| `server_preroll` | **Description:** Used to set the `Movie pre-roll video` Text box in Plex under Settings -> Extras.
You can run this with a [schedule](../config/schedule.md) to change the pre-rolls automatically.
**Values:** Any String | -| `missing_only_released` | **Description:** definition Level `missing_only_released` toggle.
**Default:** `missing_only_released` [settings value](../config/settings.md) in the Configuration File
**Values:** `true` or `false` | -| `only_filter_missing` | **Description:** definition Level `only_filter_missing` toggle.
**Default:** `only_filter_missing` [settings value](../config/settings.md) in the Configuration File
**Values:** `true` or `false` | -| `show_filtered` | **Description:** definition level `show_filtered` toggle.
**Default:** `show_filtered` [settings value](../config/settings.md) in the Configuration File
**Values:** `true` or `false` | -| `show_unfiltered` | **Description:** definition level `show_unfiltered` toggle.
**Default:** `show_unfiltered` [settings value](../config/settings.md) in the Configuration File
**Values:** `true` or `false` | -| `show_missing` | **Description:** definition level `show_missing` toggle.
**Default:** `show_missing` [settings value](../config/settings.md) in the Configuration File
**Values:** `true` or `false` | -| `save_report` | **Description:** definition level `save_report` toggle.
**Default:** `save_report` [settings value](../config/settings.md) in the Configuration File
**Values:** `true` or `false` | -| `ignore_ids` | **Description:** definition level `ignore_ids` which is combined with the library and global `ignore_ids`.
**Default:** `ignore_ids` [settings value](../config/settings.md) in the Configuration File
**Values:** List or comma-separated String of TMDb/TVDb IDs | -| `ignore_imdb_ids` | **Description:** definition level `ignore_imdb_ids` which is combined with the library and global `ignore_imdb_ids`.
**Default:** `ignore_imdb_ids` [settings value](../config/settings.md) in the Configuration File
**Values:** List or comma-separated String of IMDb IDs | -| `name_mapping` | **Description:** Used to specify the folder name in the [Image Assets Directory](../kometa/guides/assets.md) i.e. if your definition name contains characters that are not allowed in file paths (i.e. for windows `<`, `>`, `:`, `"`, `/`, `\`, `?`, `*` cannot be in the file path), but you want them in your name you can this to specify the name in the file system.
**Values:** Any String | -| `test` | **Description:** When running in Test Mode (`--run-tests` [option](../kometa/environmental.md)) only definitions with `test: true` will be run.
**Default:** `false`
**Values:** `true` or `false` | -| `tmdb_birthday` | **Description:** Controls if the Definition is run based on `tmdb_person`'s Birthday. Has 3 possible attributes `this_month`, `before` and `after`.
**Values:**
`this_month`Run's if Birthday is in current Month`true`/`false`
`before`Run if X Number of Days before the BirthdayNumber 0 or greater
`after`Run if X Number of Days after the BirthdayNumber 0 or greater
| -| `changes_webhooks` | **Description:** Used to specify a definition changes webhook for just this definition.
**Values:** List of webhooks | -| `sync_to_trakt_list` | **Description:** Used to specify a trakt list you want the definition synced to.
**Values:** Trakt List Slug you want to sync to | -| `sync_missing_to_trakt_list` | **Description:** Used to also sync missing items to the Trakt List specified by `sync_to_trakt_list`.
**Default:** `false`
**Values:** `true` or `false` | -| `run_definition` | **Description:** Used to specify if this definition runs.
Multiple can be used for one definition as a list or comma separated string. One `false` or unmatched library type will cause it to fail.
**Values:** `movie`, `show`, `artist`, `true`, `false` | -| `default_percent` | **Description:** Used to declare the default percent for `episodes`, `seasons`, `tracks`, and `albums` [special filters](filters.md#special-filters). Default is 50.
**Values:** Integer between 1 and 100 | -| `ignore_blank_results` | **Description:** Used to not have Errors resulting from blank results from builders.
**Default:** `false`
**Values:** `true` or `false` | -| `only_run_on_create` | **Description:** Used to only run the collection definition if the collection doesn't already exist.
**Default:** `false`
**Values:** `true` or `false` | -| `delete_collections_named` | **Description:** Used to delete any collections in your plex named one of the given collections.
**Values:** List of Collection Names to delete | +| Attribute | Description & Values | +|:-----------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `name` | **Description:** Used to specify the name of the definition in Plex as different than the mapping name.
**Values:** Any String | +| `limit` | **Description:** Used to specify the max number of items for the definition
**Values:** Number greater than 0 | +| `template` | **Description:** Used to specify a template and template variables to use for this definition. See the [Templates Page](templates.md) for more information.
**Values:** Dictionary | +| `schedule` | **Description:** Used to specify the schedule when this definition will run.
**Default:** `daily`
**Values:** [Any Schedule Option](../config/schedule.md) | +| `run_again` | **Description:** Used to try and add all the missing items to the definition again after the daily run.
**Default:** `false`
**Values:** `true` or `false` | +| `sync_mode` | **Description:** Used to change how builders sync with this definition.
**Default:** `sync_mode` [settings value](../config/settings.md) in the Configuration File
**Values:** `sync` or `append`
See main [settings page](../config/settings.md#sync-mode) | +| `builder_level` | **Description:** Make season, episode, album or track collections/overlays from `plex_all`, `plex_search`, `trakt_list`, or `imdb_list` Builders and Filters
**Values:**
`season`Collection contains seasons
`episode`Collection contains episodes
`album`Collection contains albums
`track`Collection contains tracks
| +| `minimum_items` | **Description:** Minimum items that must be found to add to a definition.
**Default:** `minimum_items` [settings value](../config/settings.md) in the Configuration File
**Values:** number greater than 0 | +| `delete_below_minimum` | **Description:** Deletes the definition if below the minimum.
**Default:** `delete_below_minimum` [settings value](../config/settings.md) in the Configuration File
**Values:** `true` or `false` | +| `delete_not_scheduled` | **Description:** Deletes the definition if its skipped because its not scheduled.
**Default:** `delete_not_scheduled` [settings value](../config/settings.md) in the Configuration File
**Values:** `true` or `false` | +| `tmdb_region` | **Description:** Sets the region for `tmdb_popular`, `tmdb_now_playing`, `tmdb_top_rated`, and `tmdb_upcoming` | +| `validate_builders` | **Description:** When set to false the definition will not fail if one builder fails.
**Default:** `true`
**Values:** `true` or `false` | +| `cache_builders` | **Description:** Caches the items found by the builders for a number of days. This is useful if you run the same configuration on multiple libraries/servers in one run just set the value to `1`.
**Default:** `0`
**Values:** number 0 or greater | +| `blank_collection` | **Description:** When set to true the collection will be created with no builders and no items added.
**Default:** `false`
**Values:** `true` or `false` | +| `build_collection` | **Description:** When set to false the collection won't be created but items can still be added to Radarr/Sonarr. Does not work for playlists.
**Default:** `true`
**Values:** `true` or `false` | +| `server_preroll` | **Description:** Used to set the `Movie pre-roll video` Text box in Plex under Settings -> Extras.
See the [Movie pre-roll video section on the Plex Extras Page](https://support.plex.tv/articles/202920803-extras/) for what the semicolons `;` and commas `,` mean to Plex.
You can run this with a [schedule](../config/schedule.md) to change the pre-rolls automatically.
See [Example](#server-preroll-example) below.
**Values:** Any String or a List of Strings/Nested List of Strings
* When using a list the top level elements are separated by semicolons `;` and the nested lists are separated by commas `,`. | +| `missing_only_released` | **Description:** definition Level `missing_only_released` toggle.
**Default:** `missing_only_released` [settings value](../config/settings.md) in the Configuration File
**Values:** `true` or `false` | +| `only_filter_missing` | **Description:** definition Level `only_filter_missing` toggle.
**Default:** `only_filter_missing` [settings value](../config/settings.md) in the Configuration File
**Values:** `true` or `false` | +| `show_filtered` | **Description:** definition level `show_filtered` toggle.
**Default:** `show_filtered` [settings value](../config/settings.md) in the Configuration File
**Values:** `true` or `false` | +| `show_unfiltered` | **Description:** definition level `show_unfiltered` toggle.
**Default:** `show_unfiltered` [settings value](../config/settings.md) in the Configuration File
**Values:** `true` or `false` | +| `show_missing` | **Description:** definition level `show_missing` toggle.
**Default:** `show_missing` [settings value](../config/settings.md) in the Configuration File
**Values:** `true` or `false` | +| `save_report` | **Description:** definition level `save_report` toggle.
**Default:** `save_report` [settings value](../config/settings.md) in the Configuration File
**Values:** `true` or `false` | +| `ignore_ids` | **Description:** definition level `ignore_ids` which is combined with the library and global `ignore_ids`.
**Default:** `ignore_ids` [settings value](../config/settings.md) in the Configuration File
**Values:** List or comma-separated String of TMDb/TVDb IDs | +| `ignore_imdb_ids` | **Description:** definition level `ignore_imdb_ids` which is combined with the library and global `ignore_imdb_ids`.
**Default:** `ignore_imdb_ids` [settings value](../config/settings.md) in the Configuration File
**Values:** List or comma-separated String of IMDb IDs | +| `name_mapping` | **Description:** Used to specify the folder name in the [Image Assets Directory](../kometa/guides/assets.md) i.e. if your definition name contains characters that are not allowed in file paths (i.e. for windows `<`, `>`, `:`, `"`, `/`, `\`, `?`, `*` cannot be in the file path), but you want them in your name you can this to specify the name in the file system.
**Values:** Any String | +| `test` | **Description:** When running in Test Mode (`--run-tests` [option](../kometa/environmental.md)) only definitions with `test: true` will be run.
**Default:** `false`
**Values:** `true` or `false` | +| `tmdb_birthday` | **Description:** Controls if the Definition is run based on `tmdb_person`'s Birthday. Has 3 possible attributes `this_month`, `before` and `after`.
**Values:**
`this_month`Run's if Birthday is in current Month`true`/`false`
`before`Run if X Number of Days before the BirthdayNumber 0 or greater
`after`Run if X Number of Days after the BirthdayNumber 0 or greater
| +| `changes_webhooks` | **Description:** Used to specify a definition changes webhook for just this definition.
**Values:** List of webhooks | +| `sync_to_trakt_list` | **Description:** Used to specify a trakt list you want the definition synced to.
**Values:** Trakt List Slug you want to sync to | +| `sync_missing_to_trakt_list` | **Description:** Used to also sync missing items to the Trakt List specified by `sync_to_trakt_list`.
**Default:** `false`
**Values:** `true` or `false` | +| `run_definition` | **Description:** Used to specify if this definition runs.
Multiple can be used for one definition as a list or comma separated string. One `false` or unmatched library type will cause it to fail.
**Values:** `movie`, `show`, `artist`, `true`, `false` | +| `default_percent` | **Description:** Used to declare the default percent for `episodes`, `seasons`, `tracks`, and `albums` [special filters](filters.md#special-filters). See [Example](#default-percent-example) below.
**Default:** `50`.
**Values:** Integer between 1 and 100 | +| `ignore_blank_results` | **Description:** Used to not have Errors resulting from blank results from builders.
**Default:** `false`
**Values:** `true` or `false` | +| `only_run_on_create` | **Description:** Used to only run the collection definition if the collection doesn't already exist.
**Default:** `false`
**Values:** `true` or `false` | +| `delete_collections_named` | **Description:** Used to delete any collections in your plex named one of the given collections.
**Values:** List of Collection Names to delete | + +### Default Percent Example An example of using `default_percent` which is used in an external yml file and not within config.yml: @@ -100,21 +102,37 @@ An example of using `default_percent` which is used in an external yml file and filepath.regex: 'HDR10\+|HDR10P' ``` -An example of using `server_preroll` which is also used in an external yml file and not within config.yml: +### Server Preroll Example + +An example of using `server_preroll` with a schedule which is also used in an external yml file and not within config.yml: ```yml -templates: - preroll: - default: # HERE - location: "\\path\\to\\file" +collections: + january: build_collection: false - schedule: <> - server_preroll: <> + server_preroll: "\\path\\to\\file" + schedule: range(01/01-01/31) + base: + build_collection: false + server_preroll: "\\path\\to\\file2;\\path\\to\\file3" + schedule: range(02/01-11/31) + december: + build_collection: false + server_preroll: "\\path\\to\\file4" + schedule: range(12/01-12/31) +``` + +An example of using `server_preroll` as a list with nested lists. The double dash (`- -`) denotes the start of a nested list + +```yml collections: base: - template: {name: preroll, location: "\\path\\to\\file", schedule: daily} - date1: - template: {name: preroll, location: "\\path\\to\\file", schedule: range(12/01-12/31)} - date2: - template: {name: preroll, location: "\\path\\to\\file2", schedule: range(01/01-01/31)} -``` \ No newline at end of file + build_collection: false + server_preroll: + - "\\path\\to\\file1" + - - "\\path\\to\\file2" + - "\\path\\to\\file3" + - "\\path\\to\\file4" +``` + +When Kometa adds this to Plex the translated string will be `\\path\\to\\file1;\\path\\to\\file2,\\path\\to\\file3;\\path\\to\\file4`. (Notice that some separators are semicolons `;` and some are commas `,`) \ No newline at end of file diff --git a/modules/builder.py b/modules/builder.py index 47b817cf2..58f02f28c 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -1255,7 +1255,10 @@ def _details(self, method_name, method_data, method_final, methods): elif method_name == "default_percent": self.default_percent = util.parse(self.Type, method_name, method_data, datatype="int", minimum=1, maximum=100) elif method_name == "server_preroll": - self.server_preroll = util.parse(self.Type, method_name, method_data) + if isinstance(method_data, list): + self.server_preroll = ";".join([(",".join([str(v) for v in md if v]) if isinstance(md, list) else str(md)) for md in method_data if md]) + else: + self.server_preroll = util.parse(self.Type, method_name, method_data) elif method_name == "ignore_ids": self.ignore_ids.extend(util.parse(self.Type, method_name, method_data, datatype="intlist")) elif method_name == "ignore_imdb_ids":