From 704ccfd31ab98229e01a830c2235d6d5e86ae18b Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Thu, 6 Apr 2023 10:28:10 -0400 Subject: [PATCH] [170] add include to people defaults --- CHANGELOG | 1 + VERSION | 2 +- docs/defaults/both/actor.md | 1 + docs/defaults/movie/director.md | 1 + docs/defaults/movie/producer.md | 1 + docs/defaults/movie/writer.md | 1 + modules/meta.py | 15 ++++++++++++--- modules/plex.py | 11 +++++++++-- 8 files changed, 27 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 612ac9e3..1ba02fb1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -37,6 +37,7 @@ Added `region` as a template variable options to the [`streaming` Overlay](https Added AppleTV to te [FlixPatrol Default](https://metamanager.wiki/en/latest/defaults/overlays/flixpatrol.html). Added `radarr_search` and `sonarr_search` as template variable options to all Collection Defaults. Updated `network` and `franchise` defaults +Added `include` as a template variable options to the people collections ([`actor`](https://metamanager.wiki/en/latest/defaults/both/actor.html), [`director`](https://metamanager.wiki/en/latest/defaults/movie/director.html), [`producer`](https://metamanager.wiki/en/latest/defaults/movie/producer.html), [`writer`](https://metamanager.wiki/en/latest/defaults/movie/writer.html)) to specifically include the list of actors. # Bug Fixes Fixes Bug with `--time` that caused the times not to display correctly. diff --git a/VERSION b/VERSION index b4ff05fc..bf87a4fc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.18.3-develop169 +1.18.3-develop170 diff --git a/docs/defaults/both/actor.md b/docs/defaults/both/actor.md index e926f488..df54f569 100644 --- a/docs/defaults/both/actor.md +++ b/docs/defaults/both/actor.md @@ -48,6 +48,7 @@ This file contains a [Separator](../separators) so all [Shared Separator Variabl | `sort_by` | **Description:** Changes the Smart Filter Sort for all collections in a Defaults file.
**Default:** `release.desc`
**Values:** [Any `smart_filter` Sort Option](../../metadata/builders/smart.md#sort-options) | | `sort_by_<>`1 | **Description:** Changes the Smart Filter Sort of the specified key's collection.
**Default:** `sort_by`
**Values:** [Any `smart_filter` Sort Option](../../metadata/builders/smart.md#sort-options) | | `data` | **Description:** Replaces the `data` dynamic collection value.
AttributeDescription & Values
depthControls the depth within the casting credits to search for common actors
Default: 5
Values: Number greater than 0
limitControls the maximum number of collections to create
Default: 25
Values: Number greater than 0
| +| `include` | **Description:** Force these Actors to be included to create a Dynamic Collection.
**Values:** List of Actor Names | | `exclude` | **Description:** Exclude these Actors from creating a Dynamic Collection.
**Values:** List of Actor Names | | `actor_name` | **Description:** Changes the title format of the Dynamic Collections.
**Default:** `<>`
**Values:** Any string with `<>` in it. | | `actor_summary` | **Description:** Changes the summary format of the Dynamic Collections.
**Default:** `<>s with <>.`
**Values:** Any string with `<>` in it. | diff --git a/docs/defaults/movie/director.md b/docs/defaults/movie/director.md index 3c8f9fa7..426d96ef 100644 --- a/docs/defaults/movie/director.md +++ b/docs/defaults/movie/director.md @@ -45,6 +45,7 @@ This file contains a [Separator](../separators) so all [Shared Separator Variabl | `sort_by` | **Description:** Changes the Smart Filter Sort for all collections in a Defaults file.
**Default:** `release.desc`
**Values:** [Any `smart_filter` Sort Option](../../metadata/builders/smart.md#sort-options) | | `sort_by_<>`1 | **Description:** Changes the Smart Filter Sort of the specified key's collection.
**Default:** `sort_by`
**Values:** [Any `smart_filter` Sort Option](../../metadata/builders/smart.md#sort-options) | | `data` | **Description:** Replaces the `data` dynamic collection value.
AttributeDescription & Values
depthControls the depth within the casting credits to search for common actors
Default: 5
Values: Number greater than 0
limitControls the maximum number of collections to create
Default: 25
Values: Number greater than 0
| +| `include` | **Description:** Force these Actors to be included to create a Dynamic Collection.
**Values:** List of Actor Names | | `exclude` | **Description:** Exclude these Directors from creating a Dynamic Collection.
**Values:** List of Director Names | | `director_name` | **Description:** Changes the title format of the Dynamic Collections.
**Default:** `<> (Director)`
**Values:** Any string with `<>` in it. | | `director_summary` | **Description:** Changes the summary format of the Dynamic Collections.
**Default:** `<>s directed by <>.`
**Values:** Any string with `<>` in it. | diff --git a/docs/defaults/movie/producer.md b/docs/defaults/movie/producer.md index 4e281582..64b2b1d2 100644 --- a/docs/defaults/movie/producer.md +++ b/docs/defaults/movie/producer.md @@ -45,6 +45,7 @@ This file contains a [Separator](../separators) so all [Shared Separator Variabl | `sort_by` | **Description:** Changes the Smart Filter Sort for all collections in a Defaults file.
**Default:** `release.desc`
**Values:** [Any `smart_filter` Sort Option](../../metadata/builders/smart.md#sort-options) | | `sort_by_<>`1 | **Description:** Changes the Smart Filter Sort of the specified key's collection.
**Default:** `sort_by`
**Values:** [Any `smart_filter` Sort Option](../../metadata/builders/smart.md#sort-options) | | `data` | **Description:** Replaces the `data` dynamic collection value.
AttributeDescription & Values
depthControls the depth within the casting credits to search for common actors
Default: 5
Values: Number greater than 0
limitControls the maximum number of collections to create
Default: 25
Values: Number greater than 0
| +| `include` | **Description:** Force these Actors to be included to create a Dynamic Collection.
**Values:** List of Actor Names | | `exclude` | **Description:** Exclude these Producers from creating a Dynamic Collection.
**Values:** List of Producer Names | | `producer_name` | **Description:** Changes the title format of the Dynamic Collections.
**Default:** `<> (Producer)`
**Values:** Any string with `<>` in it. | | `producer_summary` | **Description:** Changes the summary format of the Dynamic Collections.
**Default:** `<>s produced by <>.`
**Values:** Any string with `<>` in it. | diff --git a/docs/defaults/movie/writer.md b/docs/defaults/movie/writer.md index 365b5a0f..5bb2ac25 100644 --- a/docs/defaults/movie/writer.md +++ b/docs/defaults/movie/writer.md @@ -45,6 +45,7 @@ This file contains a [Separator](../separators) so all [Shared Separator Variabl | `sort_by` | **Description:** Changes the Smart Filter Sort for all collections in a Defaults file.
**Default:** `release.desc`
**Values:** [Any `smart_filter` Sort Option](../../metadata/builders/smart.md#sort-options) | | `sort_by_<>`1 | **Description:** Changes the Smart Filter Sort of the specified key's collection.
**Default:** `sort_by`
**Values:** [Any `smart_filter` Sort Option](../../metadata/builders/smart.md#sort-options) | | `data` | **Description:** Replaces the `data` dynamic collection value.
AttributeDescription & Values
depthControls the depth within the casting credits to search for common actors
Default: 5
Values: Number greater than 0
limitControls the maximum number of collections to create
Default: 25
Values: Number greater than 0
| +| `include` | **Description:** Force these Actors to be included to create a Dynamic Collection.
**Values:** List of Actor Names | | `exclude` | **Description:** Exclude these Writers from creating a Dynamic Collection.
**Values:** List of Writer Names | | `writer_name` | **Description:** Changes the title format of the Dynamic Collections.
**Default:** `<> (Writer)`
**Values:** Any string with `<>` in it. | | `writer_summary` | **Description:** Changes the summary format of the Dynamic Collections.
**Default:** `<>s written by <>.`
**Values:** Any string with `<>` in it. | diff --git a/modules/meta.py b/modules/meta.py index 17ee050a..623f94bc 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -921,14 +921,19 @@ class MetadataFile(DataFile): person_minimum = util.parse("Config", "minimum", dynamic_data, parent=f"{map_name} data", methods=person_methods, datatype="int", default=3, minimum=1) if "minimum" in person_methods else None person_limit = util.parse("Config", "limit", dynamic_data, parent=f"{map_name} data", methods=person_methods, datatype="int", default=25, minimum=1) if "limit" in person_methods else None lib_all = library.get_all() + include_cols = [] for i, item in enumerate(lib_all, 1): logger.ghost(f"Scanning: {i}/{len(lib_all)} {item.title}") try: item = self.library.reload(item) for person in getattr(item, f"{auto_type}s")[:person_depth]: - if person.id not in people: - people[person.id] = {"name": person.tag, "count": 0} - people[person.id]["count"] += 1 + if person.tag in include: + if person.tag not in include_cols: + include_cols.append(person.tag) + else: + if person.id not in people: + people[person.id] = {"name": person.tag, "count": 0} + people[person.id]["count"] += 1 except Failed as e: logger.error(f"Plex Error: {e}") roles = [data for _, data in people.items()] @@ -938,6 +943,10 @@ class MetadataFile(DataFile): if not person_limit: person_limit = len(roles) person_count = 0 + for inc in include_cols: + auto_list[inc] = inc + all_keys[inc] = inc + person_count += 1 for role in roles: if person_count < person_limit and role["count"] >= person_minimum and role["name"] not in exclude: auto_list[role["name"]] = role["name"] diff --git a/modules/plex.py b/modules/plex.py index 9061cf92..68c86960 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -824,7 +824,6 @@ class Plex(Library): for r in self.Plex.fetchItems(f"/hubs/sections/{self.Plex.key}/manage")] def alter_collection(self, item, collection, smart_label_collection=False, add=True): - collection = str(collection) if smart_label_collection: self.query_data(item.addLabel if add else item.removeLabel, collection) else: @@ -833,7 +832,15 @@ class Plex(Library): if self.agent in ["tv.plex.agents.movie", "tv.plex.agents.series"]: field = next((f for f in item.fields if f.name == "collection"), None) locked = field is not None - self.query_collection(item, collection, locked=locked, add=add) + try: + self.query_collection(item, collection, locked=locked, add=add) + except TypeError: + logger.info(item.collections) + for col in item.collections: + logger.info(col.id) + logger.info(col.key) + logger.info(col.tag) + raise def move_item(self, collection, item, after=None): key = f"{collection.key}/items/{item}/move"