[18] adds this month to birthdays

This commit is contained in:
meisnate12 2023-04-18 13:50:39 -04:00
parent a8888e7c31
commit f16710e3c7
8 changed files with 19 additions and 10 deletions

View file

@ -1 +1 @@
1.19.0-develop17
1.19.0-develop18

View file

@ -133,6 +133,7 @@ templates:
tmdb_person: <<tmdb_person>>
tmdb_birthday: <<tmdb_birthday>>
tmdb_person_offset: <<tmdb_person_offset_<<key>>>>
delete_not_scheduled: true
url_poster: <<url_poster_<<key>>>>
conditionals:
extra:

View file

@ -52,7 +52,7 @@ This file contains a [Separator](../separators) so all [Shared Separator Variabl
| `exclude` | **Description:** Exclude these Actors from creating a Dynamic Collection.<br>**Values:** List of Actor Names |
| `name_format` | **Description:** Changes the title format of the Dynamic Collections.<br>**Default:** `<<key_name>>`<br>**Values:** Any string with `<<key_name>>` in it. |
| `summary_format` | **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. |
| `tmdb_birthday` | **Description:** Has 2 possible attributes `before` and `after` which represents the number of days before/after the `tmdb_person`'s birthday which allows the definition to run.<br>**Values:** Any Number 0 or greater<br>**Default:** 0 |
| `tmdb_birthday` | **Description:** Controls if the Definition is run based on `tmdb_person`'s Birthday. Has 3 possible attributes `this_month`, `before` and `after`.<br>**Values:**<table class="clearTable"><tr><td>`this_month`</td><td>Run's if Birthday is in current Month</td><td>`true`/`false`</td></tr><tr><td>`before`</td><td>Run if X Number of Days before the Birthday</td><td>Number 0 or greater</td></tr><tr><td>`after`</td><td>Run if X Number of Days after the Birthday</td><td>Number 0 or greater</td></tr></table> |
| `tmdb_person_offset_<<key>>`<sup>1</sup> | **Description:** Changes the summary tmdb_person_offset for the specific key.<br>**Default:** `0`<br>**Values:** Dictionary of Actor Name as the keys and the tmdb_person_offset as the value. |
1. Each default collection has a `key` that when calling to effect a specific collection you must replace `<<key>>` with when calling.

View file

@ -49,7 +49,7 @@ This file contains a [Separator](../separators) so all [Shared Separator Variabl
| `exclude` | **Description:** Exclude these Directors from creating a Dynamic Collection.<br>**Values:** List of Director Names |
| `name_format` | **Description:** Changes the title format of the Dynamic Collections.<br>**Default:** `<<key_name>> (Director)`<br>**Values:** Any string with `<<key_name>>` in it. |
| `summary_format` | **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. |
| `tmdb_birthday` | **Description:** Has 2 possible attributes `before` and `after` which represents the number of days before/after the `tmdb_person`'s birthday which allows the definition to run.<br>**Values:** Any Number 0 or greater<br>**Default:** 0 |
| `tmdb_birthday` | **Description:** Controls if the Definition is run based on `tmdb_person`'s Birthday. Has 3 possible attributes `this_month`, `before` and `after`.<br>**Values:**<table class="clearTable"><tr><td>`this_month`</td><td>Run's if Birthday is in current Month</td><td>`true`/`false`</td></tr><tr><td>`before`</td><td>Run if X Number of Days before the Birthday</td><td>Number 0 or greater</td></tr><tr><td>`after`</td><td>Run if X Number of Days after the Birthday</td><td>Number 0 or greater</td></tr></table> |
| `tmdb_person_offset_<<key>>`<sup>1</sup> | **Description:** Changes the summary tmdb_person_offset for the specific key.<br>**Default:** `0`<br>**Values:** Dictionary of Actor Name as the keys and the tmdb_person_offset as the value. |
1. Each default collection has a `key` that when calling to effect a specific collection you must replace `<<key>>` with when calling.

View file

@ -49,7 +49,7 @@ This file contains a [Separator](../separators) so all [Shared Separator Variabl
| `exclude` | **Description:** Exclude these Producers from creating a Dynamic Collection.<br>**Values:** List of Producer Names |
| `name_format` | **Description:** Changes the title format of the Dynamic Collections.<br>**Default:** `<<key_name>> (Producer)`<br>**Values:** Any string with `<<key_name>>` in it. |
| `summary_format` | **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. |
| `tmdb_birthday` | **Description:** Has 2 possible attributes `before` and `after` which represents the number of days before/after the `tmdb_person`'s birthday which allows the definition to run.<br>**Values:** Any Number 0 or greater<br>**Default:** 0 |
| `tmdb_birthday` | **Description:** Controls if the Definition is run based on `tmdb_person`'s Birthday. Has 3 possible attributes `this_month`, `before` and `after`.<br>**Values:**<table class="clearTable"><tr><td>`this_month`</td><td>Run's if Birthday is in current Month</td><td>`true`/`false`</td></tr><tr><td>`before`</td><td>Run if X Number of Days before the Birthday</td><td>Number 0 or greater</td></tr><tr><td>`after`</td><td>Run if X Number of Days after the Birthday</td><td>Number 0 or greater</td></tr></table> |
| `tmdb_person_offset_<<key>>`<sup>1</sup> | **Description:** Changes the summary tmdb_person_offset for the specific key.<br>**Default:** `0`<br>**Values:** Dictionary of Actor Name as the keys and the tmdb_person_offset as the value. |
1. Each default collection has a `key` that when calling to effect a specific collection you must replace `<<key>>` with when calling.

View file

@ -49,7 +49,7 @@ This file contains a [Separator](../separators) so all [Shared Separator Variabl
| `exclude` | **Description:** Exclude these Writers from creating a Dynamic Collection.<br>**Values:** List of Writer Names |
| `name_format` | **Description:** Changes the title format of the Dynamic Collections.<br>**Default:** `<<key_name>> (Writer)`<br>**Values:** Any string with `<<key_name>>` in it. |
| `summary_format` | **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. |
| `tmdb_birthday` | **Description:** Has 2 possible attributes `before` and `after` which represents the number of days before/after the `tmdb_person`'s birthday which allows the definition to run.<br>**Values:** Any Number 0 or greater<br>**Default:** 0 |
| `tmdb_birthday` | **Description:** Controls if the Definition is run based on `tmdb_person`'s Birthday. Has 3 possible attributes `this_month`, `before` and `after`.<br>**Values:**<table class="clearTable"><tr><td>`this_month`</td><td>Run's if Birthday is in current Month</td><td>`true`/`false`</td></tr><tr><td>`before`</td><td>Run if X Number of Days before the Birthday</td><td>Number 0 or greater</td></tr><tr><td>`after`</td><td>Run if X Number of Days after the Birthday</td><td>Number 0 or greater</td></tr></table> |
| `tmdb_person_offset_<<key>>`<sup>1</sup> | **Description:** Changes the summary tmdb_person_offset for the specific key.<br>**Default:** `0`<br>**Values:** Dictionary of Actor Name as the keys and the tmdb_person_offset as the value. |
1. Each default collection has a `key` that when calling to effect a specific collection you must replace `<<key>>` with when calling.

View file

@ -8,7 +8,7 @@ All the following attributes update various details of the definition's Metadata
|:-----------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `tmdb_person` | **Description:** Changes summary and poster to a TMDb Person's biography and profile to the first specified person as well as allow the people specified to be used in [Plex Searches](../builders/plex.md#plex-search).<br>**Values:** TMDb Person ID or Actor Name (Will pull the first ID from the TMDb search results) (List or Comma-separated string) |
| `tmdb_person_offset` | **Description:** Offsets which search results are used by `tmdb_person`.<br>**Values:** Any Number greater then 0<br>**Default:** 0 |
| `tmdb_birthday` | **Description:** Has 2 possible attributes `before` and `after` which represents the number of days before/after the `tmdb_person`'s birthday which allows the definition to run.<br>**Values:** Any Number 0 or greater<br>**Default:** 0 |
| `tmdb_birthday` | **Description:** Controls if the Definition is run based on `tmdb_person`'s Birthday. Has 3 possible attributes `this_month`, `before` and `after`.<br>**Values:**<table class="clearTable"><tr><td>`this_month`</td><td>Run's if Birthday is in current Month</td><td>`true`/`false`</td></tr><tr><td>`before`</td><td>Run if X Number of Days before the Birthday</td><td>Number 0 or greater</td></tr><tr><td>`after`</td><td>Run if X Number of Days after the Birthday</td><td>Number 0 or greater</td></tr></table> |
| `sort_title` | **Description:** Changes the sort title.<br>You can "promote" certain collections to the top of a library by creating a sort title starting with a `+` or "demote" certain collections to the bottom of a library by creating a sort title starting with a `~`.<br>**Values:** Text to change Sort Title |
| `content_rating` | **Description:** Changes the content rating.<br>**Values:** Text to change Content Rating |
| `label` | **Description:** Appends new labels.<br>**Values:** Comma-separated string of labels to append |

View file

@ -289,6 +289,7 @@ class CollectionBuilder:
if key_name_key and key_name_key in translations["key_names"]:
trans_key = translations["key_names"][key_name_key]
logger.debug(f"Value: {trans_key}")
self.key_name = trans_key
en_name = None
en_summary = None
@ -768,7 +769,8 @@ class CollectionBuilder:
parsed_methods = {m.lower(): m for m in parsed_birthday}
self.tmdb_birthday = {
"before": util.parse(self.Type, "before", parsed_birthday, datatype="int", methods=parsed_methods, minimum=0, default=0),
"after": util.parse(self.Type, "after", parsed_birthday, datatype="int", methods=parsed_methods, minimum=0, default=0)
"after": util.parse(self.Type, "after", parsed_birthday, datatype="int", methods=parsed_methods, minimum=0, default=0),
"this_month": util.parse(self.Type, "this_month", parsed_birthday, datatype="bool", methods=parsed_methods, default=False)
}
first_person = None
@ -841,7 +843,13 @@ class CollectionBuilder:
after_delta = datetime(now.year - 1, self.tmdb_person_birthday.month, 28)
days_after = (now - after_delta).days
days_before = (before_delta - now).days
if days_before > self.tmdb_birthday["before"] and days_after > self.tmdb_birthday["after"]:
msg = ""
if self.tmdb_birthday["this_month"]:
if now.month != self.tmdb_person_birthday.month:
msg = f"Skipped because Birthday Month: {self.tmdb_person_birthday.month} is not {now.month}"
elif days_before > self.tmdb_birthday["before"] and days_after > self.tmdb_birthday["after"]:
msg = f"Skipped because days until {self.tmdb_person_birthday.month}/{self.tmdb_person_birthday.day}: {days_before} > {self.tmdb_birthday['before']} and days after {self.tmdb_person_birthday.month}/{self.tmdb_person_birthday.day}: {days_after} > {self.tmdb_birthday['after']}"
if msg:
suffix = ""
if self.details["delete_not_scheduled"]:
try:
@ -851,7 +859,7 @@ class CollectionBuilder:
suffix = f" and was deleted"
except Failed:
suffix = f" and could not be found to delete"
raise NotScheduled(f"Skipped because days until {self.tmdb_person_birthday.month}/{self.tmdb_person_birthday.day}: {days_before} > {self.tmdb_birthday['before']} and days after {self.tmdb_person_birthday.month}/{self.tmdb_person_birthday.day}: {days_after} > {self.tmdb_birthday['after']}{suffix}")
raise NotScheduled(f"{msg}{suffix}")
self.smart_url = None
self.smart_type_key = None
@ -1130,7 +1138,7 @@ class CollectionBuilder:
def _summary(self, method_name, method_data):
if method_name == "summary":
self.summaries[method_name] = method_data
self.summaries[method_name] = str(method_data).replace("<<key_name>>", self.key_name) if self.key_name else method_data
elif method_name == "tmdb_summary":
self.summaries[method_name] = self.config.TMDb.get_movie_show_or_collection(util.regex_first_int(method_data, "TMDb ID"), self.library.is_movie).overview
elif method_name == "tmdb_description":