[170] add include to people defaults

pull/1365/head
meisnate12 2 years ago
parent 65015d7041
commit 704ccfd31a

@ -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.

@ -1 +1 @@
1.18.3-develop169
1.18.3-develop170

@ -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.<br>**Default:** `release.desc`<br>**Values:** [Any `smart_filter` Sort Option](../../metadata/builders/smart.md#sort-options) |
| `sort_by_<<key>>`<sup>1</sup> | **Description:** Changes the Smart Filter Sort of the specified key's collection.<br>**Default:** `sort_by`<br>**Values:** [Any `smart_filter` Sort Option](../../metadata/builders/smart.md#sort-options) |
| `data` | **Description:** Replaces the `data` dynamic collection value.<table class="clearTable"><tr><th>Attribute</th><th>Description & Values</th></tr><tr><td><code>depth</code></td><td>Controls the depth within the casting credits to search for common actors<hr><strong>Default:</strong> 5<hr><strong>Values:</strong> Number greater than 0</td></tr><tr><td><code>limit</code></td><td>Controls the maximum number of collections to create<hr><strong>Default:</strong> 25<hr><strong>Values:</strong> Number greater than 0</td></tr></table> |
| `include` | **Description:** Force these Actors to be included to create a Dynamic Collection.<br>**Values:** List of Actor Names |
| `exclude` | **Description:** Exclude these Actors from creating a Dynamic Collection.<br>**Values:** List of Actor Names |
| `actor_name` | **Description:** Changes the title format of the Dynamic Collections.<br>**Default:** `<<key_name>>`<br>**Values:** Any string with `<<key_name>>` in it. |
| `actor_summary` | **Description:** Changes the summary format of the Dynamic Collections.<br>**Default:** `<<library_translationU>>s with <<key_name>>.`<br>**Values:** Any string with `<<key_name>>` in it. |

@ -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.<br>**Default:** `release.desc`<br>**Values:** [Any `smart_filter` Sort Option](../../metadata/builders/smart.md#sort-options) |
| `sort_by_<<key>>`<sup>1</sup> | **Description:** Changes the Smart Filter Sort of the specified key's collection.<br>**Default:** `sort_by`<br>**Values:** [Any `smart_filter` Sort Option](../../metadata/builders/smart.md#sort-options) |
| `data` | **Description:** Replaces the `data` dynamic collection value.<table class="clearTable"><tr><th>Attribute</th><th>Description & Values</th></tr><tr><td><code>depth</code></td><td>Controls the depth within the casting credits to search for common actors<hr><strong>Default:</strong> 5<hr><strong>Values:</strong> Number greater than 0</td></tr><tr><td><code>limit</code></td><td>Controls the maximum number of collections to create<hr><strong>Default:</strong> 25<hr><strong>Values:</strong> Number greater than 0</td></tr></table> |
| `include` | **Description:** Force these Actors to be included to create a Dynamic Collection.<br>**Values:** List of Actor Names |
| `exclude` | **Description:** Exclude these Directors from creating a Dynamic Collection.<br>**Values:** List of Director Names |
| `director_name` | **Description:** Changes the title format of the Dynamic Collections.<br>**Default:** `<<key_name>> (Director)`<br>**Values:** Any string with `<<key_name>>` in it. |
| `director_summary` | **Description:** Changes the summary format of the Dynamic Collections.<br>**Default:** `<<library_translationU>>s directed by <<key_name>>.`<br>**Values:** Any string with `<<key_name>>` in it. |

@ -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.<br>**Default:** `release.desc`<br>**Values:** [Any `smart_filter` Sort Option](../../metadata/builders/smart.md#sort-options) |
| `sort_by_<<key>>`<sup>1</sup> | **Description:** Changes the Smart Filter Sort of the specified key's collection.<br>**Default:** `sort_by`<br>**Values:** [Any `smart_filter` Sort Option](../../metadata/builders/smart.md#sort-options) |
| `data` | **Description:** Replaces the `data` dynamic collection value.<table class="clearTable"><tr><th>Attribute</th><th>Description & Values</th></tr><tr><td><code>depth</code></td><td>Controls the depth within the casting credits to search for common actors<hr><strong>Default:</strong> 5<hr><strong>Values:</strong> Number greater than 0</td></tr><tr><td><code>limit</code></td><td>Controls the maximum number of collections to create<hr><strong>Default:</strong> 25<hr><strong>Values:</strong> Number greater than 0</td></tr></table> |
| `include` | **Description:** Force these Actors to be included to create a Dynamic Collection.<br>**Values:** List of Actor Names |
| `exclude` | **Description:** Exclude these Producers from creating a Dynamic Collection.<br>**Values:** List of Producer Names |
| `producer_name` | **Description:** Changes the title format of the Dynamic Collections.<br>**Default:** `<<key_name>> (Producer)`<br>**Values:** Any string with `<<key_name>>` in it. |
| `producer_summary` | **Description:** Changes the summary format of the Dynamic Collections.<br>**Default:** `<<library_translationU>>s produced by <<key_name>>.`<br>**Values:** Any string with `<<key_name>>` in it. |

@ -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.<br>**Default:** `release.desc`<br>**Values:** [Any `smart_filter` Sort Option](../../metadata/builders/smart.md#sort-options) |
| `sort_by_<<key>>`<sup>1</sup> | **Description:** Changes the Smart Filter Sort of the specified key's collection.<br>**Default:** `sort_by`<br>**Values:** [Any `smart_filter` Sort Option](../../metadata/builders/smart.md#sort-options) |
| `data` | **Description:** Replaces the `data` dynamic collection value.<table class="clearTable"><tr><th>Attribute</th><th>Description & Values</th></tr><tr><td><code>depth</code></td><td>Controls the depth within the casting credits to search for common actors<hr><strong>Default:</strong> 5<hr><strong>Values:</strong> Number greater than 0</td></tr><tr><td><code>limit</code></td><td>Controls the maximum number of collections to create<hr><strong>Default:</strong> 25<hr><strong>Values:</strong> Number greater than 0</td></tr></table> |
| `include` | **Description:** Force these Actors to be included to create a Dynamic Collection.<br>**Values:** List of Actor Names |
| `exclude` | **Description:** Exclude these Writers from creating a Dynamic Collection.<br>**Values:** List of Writer Names |
| `writer_name` | **Description:** Changes the title format of the Dynamic Collections.<br>**Default:** `<<key_name>> (Writer)`<br>**Values:** Any string with `<<key_name>>` in it. |
| `writer_summary` | **Description:** Changes the summary format of the Dynamic Collections.<br>**Default:** `<<library_translationU>>s written by <<key_name>>.`<br>**Values:** Any string with `<<key_name>>` in it. |

@ -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"]

@ -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"

Loading…
Cancel
Save