[190] #1143 add current_year to plex_search, smart_filter, and filters year attributes

pull/1165/head
meisnate12 2 years ago
parent 5824a4a88f
commit 1ec4a9bebb

@ -29,6 +29,7 @@ Added `versions` [number filter](https://metamanager.wiki/en/latest/metadata/fil
Added `imdb_watchlist` [builder](https://metamanager.wiki/en/latest/metadata/builders/imdb.html#imdb-watchlist)
Added `item_genre` [item metadata detail](https://metamanager.wiki/en/latest/metadata/details/metadata.html#item-metadata-details) to update the genres of items in a collection
Added `plex_watchlist` [Builder](https://metamanager.wiki/en/latest/metadata/builders/plex.html#plex-watchlist)
Adds `current_year` to `plex_search`, `smart_filter`, and `filter` year/decade attributes.
Added `stroke_width` and `stroke_color` as options for text overlays
Added multiple new [special text variables](https://metamanager.wiki/en/latest/metadata/overlay.html#special-text-variables) and modifiers.
Added support for the [AniDB API](https://metamanager.wiki/en/latest/config/anidb.html)

@ -1 +1 @@
1.17.3-develop189
1.17.3-develop190

@ -6,7 +6,7 @@ This is the simplest way to create Overlays using Plex Meta Manager.
## Overlay Files
```{include} ../overlay_list.md
```{include} overlay_list.md
```
## Configurations
@ -239,5 +239,5 @@ Each file has a page on the wiki showing the available `template_variables` for
### Examples
```{include} ../example.md
```{include} example.md
```

@ -211,7 +211,7 @@ Tag search can take multiple values as a **list or a comma-separated string**.
### Tag Attributes
| Tag Search | Description | Movie<br>Libraries | Show<br>Libraries | Music<br>Libraries |
|:---------------------|:----------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:|
|:---------------------------|:----------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:|
| `actor` | Uses the actor tags to match | &#9989; | &#9989; | &#10060; |
| `audio_language` | Uses the audio language tags to match | &#9989; | &#9989; | &#10060; |
| `collection` | Uses the collection tags to match for top level collections | &#9989; | &#9989; | &#10060; |
@ -219,7 +219,7 @@ Tag search can take multiple values as a **list or a comma-separated string**.
| `episode_collection` | Uses the collection tags to match for episode collections | &#10060; | &#9989; | &#10060; |
| `content_rating` | Uses the content rating tags to match | &#9989; | &#9989; | &#10060; |
| `country` | Uses the country tags to match | &#9989; | &#10060; | &#10060; |
| `decade` | Uses the year tag to match the decade | &#9989; | &#10060; | &#10060; |
| `decade`<sup>1</sup> | Uses the year tag to match the decade | &#9989; | &#10060; | &#10060; |
| `director` | Uses the director tags to match | &#9989; | &#10060; | &#10060; |
| `genre` | Uses the genre tags to match | &#9989; | &#9989; | &#10060; |
| `label` | Uses the label tags to match for top level collections | &#9989; | &#9989; | &#10060; |
@ -230,8 +230,8 @@ Tag search can take multiple values as a **list or a comma-separated string**.
| `resolution` | Uses the resolution tags to match | &#9989; | &#9989; | &#10060; |
| `subtitle_language` | Uses the subtitle language tags to match | &#9989; | &#9989; | &#10060; |
| `writer` | Uses the writer tags to match | &#9989; | &#10060; | &#10060; |
| `year` | Uses the year tag to match | &#9989; | &#9989; | &#10060; |
| `episode_year` | Uses the year tag to match | &#10060; | &#9989; | &#10060; |
| `year`<sup>1</sup> | Uses the year tag to match | &#9989; | &#9989; | &#10060; |
| `episode_year`<sup>1</sup> | Uses the year tag to match | &#10060; | &#9989; | &#10060; |
| `artist_genre` | Uses the Artist's Genre attribute to match | &#10060; | &#10060; | &#9989; |
| `artist_collection` | Uses the Artist's Collection attribute to match | &#10060; | &#10060; | &#9989; |
| `artist_country` | Uses the Artist's Country attribute to match | &#10060; | &#10060; | &#9989; |
@ -250,6 +250,8 @@ Tag search can take multiple values as a **list or a comma-separated string**.
| `track_source` | Uses the Track's Style attribute to match | &#10060; | &#10060; | &#9989; |
| `track_label` | Uses the Track's Label attribute to match | &#10060; | &#10060; | &#9989; |
<sup>1</sup> You can use `current_year` to have PMM use the current years value. This can be combined with a `-#` at the end to subtract that number of years. i.e. `current-2`
## Date Searches
Date searches can be used with either no modifier or with `.not`, `.before`, or `.after`.
@ -306,7 +308,7 @@ No number search can take multiple values.
### Number Attributes
| Number Search | Description | Movie<br>Libraries | Show<br>Libraries | Music<br>Libraries |
|:--------------------------|:------------------------------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:|
|:---------------------------|:------------------------------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:|
| `duration` | Uses the duration attribute to match using minutes<br>**Minimum:** `0` | &#9989; | &#10060; | &#10060; |
| `plays` | Uses the plays attribute to match<br>**Minimum:** `0` | &#9989; | &#9989; | &#10060; |
| `episode_plays` | Uses the Episode's plays attribute to match<br>**Minimum:** `0` | &#10060; | &#9989; | &#10060; |
@ -316,10 +318,10 @@ No number search can take multiple values.
| `episode_user_rating` | Uses the user rating attribute of the show's episodes to match<br>**Range:** `0.0` - `10.0` | &#10060; | &#9989; | &#10060; |
| `episode_critic_rating` | Uses the critic rating attribute of the show's episodes to match<br>**Range:** `0.0` - `10.0` | &#10060; | &#9989; | &#10060; |
| `episode_audience_rating` | Uses the audience rating attribute of the show's episodes to match<br>**Range:** `0.0` - `10.0` | &#10060; | &#9989; | &#10060; |
| `year` | Uses the year attribute to match<br>**Minimum:** `0` | &#9989; | &#9989; | &#10060; |
| `episode_year` | Uses the Episode's year attribute to match<br>**Minimum:** `0` | &#10060; | &#9989; | &#10060; |
| `album_year` | Uses the Album's year attribute to match<br>**Minimum:** `0` | &#10060; | &#10060; | &#9989; |
| `album_decade` | Uses the Album's decade attribute to match<br>**Minimum:** `0` | &#10060; | &#10060; | &#9989; |
| `year`<sup>1</sup> | Uses the year attribute to match<br>**Minimum:** `0` | &#9989; | &#9989; | &#10060; |
| `episode_year`<sup>1</sup> | Uses the Episode's year attribute to match<br>**Minimum:** `0` | &#10060; | &#9989; | &#10060; |
| `album_year`<sup>1</sup> | Uses the Album's year attribute to match<br>**Minimum:** `0` | &#10060; | &#10060; | &#9989; |
| `album_decade`<sup>1</sup> | Uses the Album's decade attribute to match<br>**Minimum:** `0` | &#10060; | &#10060; | &#9989; |
| `album_plays` | Uses the Album's plays attribute to match<br>**Minimum:** `0` | &#10060; | &#10060; | &#9989; |
| `track_plays` | Uses the Track's plays attribute to match<br>**Minimum:** `0` | &#10060; | &#10060; | &#9989; |
| `track_skips` | Uses the Track's skips attribute to match<br>**Minimum:** `0` | &#10060; | &#10060; | &#9989; |
@ -328,6 +330,8 @@ No number search can take multiple values.
| `album_critic_rating` | Uses the Album's critic rating attribute to match<br>**Range:** `0.0` - `10.0` | &#10060; | &#10060; | &#9989; |
| `track_user_rating` | Uses the Track's user rating attribute to match<br>**Range:** `0.0` - `10.0` | &#10060; | &#10060; | &#9989; |
<sup>1</sup> You can use `current_year` to have PMM use the current years value. This can be combined with a `-#` at the end to subtract that number of years. i.e. `current-2`
## Boolean Searches
Boolean Searches take no modifier and can only be either `true` or `false`.

@ -145,7 +145,7 @@ Tag filter can take multiple values as a **list or a comma-separated string**.
### Tag Attributes
| Tag Search | Description | Movie<br>Libraries | Show<br>Libraries | Music<br>Libraries |
|:---------------------|:----------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:|
|:---------------------------|:----------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:|
| `actor` | Uses the actor tags to match | &#9989; | &#9989; | &#10060; |
| `audio_language` | Uses the audio language tags to match | &#9989; | &#9989; | &#10060; |
| `collection` | Uses the collection tags to match for top level collections | &#9989; | &#9989; | &#10060; |
@ -153,7 +153,7 @@ Tag filter can take multiple values as a **list or a comma-separated string**.
| `episode_collection` | Uses the collection tags to match for episode collections | &#10060; | &#9989; | &#10060; |
| `content_rating` | Uses the content rating tags to match | &#9989; | &#9989; | &#10060; |
| `country` | Uses the country tags to match | &#9989; | &#10060; | &#10060; |
| `decade` | Uses the year tag to match the decade | &#9989; | &#10060; | &#10060; |
| `decade`<sup>1</sup> | Uses the year tag to match the decade | &#9989; | &#10060; | &#10060; |
| `director` | Uses the director tags to match | &#9989; | &#10060; | &#10060; |
| `genre` | Uses the genre tags to match | &#9989; | &#9989; | &#10060; |
| `label` | Uses the label tags to match for top level collections | &#9989; | &#9989; | &#10060; |
@ -164,8 +164,8 @@ Tag filter can take multiple values as a **list or a comma-separated string**.
| `resolution` | Uses the resolution tags to match | &#9989; | &#9989; | &#10060; |
| `subtitle_language` | Uses the subtitle language tags to match | &#9989; | &#9989; | &#10060; |
| `writer` | Uses the writer tags to match | &#9989; | &#10060; | &#10060; |
| `year` | Uses the year tag to match | &#9989; | &#9989; | &#10060; |
| `episode_year` | Uses the year tag to match | &#10060; | &#9989; | &#10060; |
| `year`<sup>1</sup> | Uses the year tag to match | &#9989; | &#9989; | &#10060; |
| `episode_year`<sup>1</sup> | Uses the year tag to match | &#10060; | &#9989; | &#10060; |
| `artist_genre` | Uses the Artist's Genre attribute to match | &#10060; | &#10060; | &#9989; |
| `artist_collection` | Uses the Artist's Collection attribute to match | &#10060; | &#10060; | &#9989; |
| `artist_country` | Uses the Artist's Country attribute to match | &#10060; | &#10060; | &#9989; |
@ -184,6 +184,8 @@ Tag filter can take multiple values as a **list or a comma-separated string**.
| `track_source` | Uses the Track's Style attribute to match | &#10060; | &#10060; | &#9989; |
| `track_label` | Uses the Track's Label attribute to match | &#10060; | &#10060; | &#9989; |
<sup>1</sup> You can use `current_year` to have PMM use the current years value. This can be combined with a `-#` at the end to subtract that number of years. i.e. `current-2`
## Date Filters
Date filters can be used with either no modifier or with `.not`, `.before`, or `.after`.
@ -240,7 +242,7 @@ No number filter can take multiple values.
### Number Attributes
| Number Search | Description | Movie<br>Libraries | Show<br>Libraries | Music<br>Libraries |
|:----------------------|:--------------------------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:|
|:---------------------------|:--------------------------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:|
| `duration` | Uses the duration attribute to match using minutes<br>**Minimum:** `0` | &#9989; | &#10060; | &#10060; |
| `plays` | Uses the plays attribute to match<br>**Minimum:** `0` | &#9989; | &#9989; | &#10060; |
| `episode_plays` | Uses the Episode's plays attribute to match<br>**Minimum:** `0` | &#10060; | &#9989; | &#10060; |
@ -248,10 +250,10 @@ No number filter can take multiple values.
| `audience_rating` | Uses the audience rating attribute to match<br>**Range:** `0.0` - `10.0` | &#9989; | &#9989; | &#10060; |
| `user_rating` | Uses the user rating attribute to match<br>**Range:** `0.0` - `10.0` | &#9989; | &#9989; | &#10060; |
| `episode_user_rating` | Uses the user rating attribute of the show's episodes to match<br>**Range:** `0.0` - `10.0` | &#10060; | &#9989; | &#10060; |
| `year` | Uses the year attribute to match<br>**Minimum:** `0` | &#9989; | &#9989; | &#10060; |
| `episode_year` | Uses the Episode's year attribute to match<br> **Minimum:** `0` | &#10060; | &#9989; | &#10060; |
| `album_year` | Uses the Album's year attribute to match<br>**Minimum:** `0` | &#10060; | &#10060; | &#9989; |
| `album_decade` | Uses the Album's decade attribute to match<br>**Minimum:** `0` | &#10060; | &#10060; | &#9989; |
| `year`<sup>1</sup> | Uses the year attribute to match<br>**Minimum:** `0` | &#9989; | &#9989; | &#10060; |
| `episode_year`<sup>1</sup> | Uses the Episode's year attribute to match<br> **Minimum:** `0` | &#10060; | &#9989; | &#10060; |
| `album_year`<sup>1</sup> | Uses the Album's year attribute to match<br>**Minimum:** `0` | &#10060; | &#10060; | &#9989; |
| `album_decade`<sup>1</sup> | Uses the Album's decade attribute to match<br>**Minimum:** `0` | &#10060; | &#10060; | &#9989; |
| `album_plays` | Uses the Album's plays attribute to match<br>**Minimum:** `0` | &#10060; | &#10060; | &#9989; |
| `track_plays` | Uses the Track's plays attribute to match<br>**Minimum:** `0` | &#10060; | &#10060; | &#9989; |
| `track_skips` | Uses the Track's skips attribute to match<br>**Minimum:** `0` | &#10060; | &#10060; | &#9989; |
@ -260,6 +262,8 @@ No number filter can take multiple values.
| `album_critic_rating` | Uses the Album's critic rating attribute to match<br>**Range:** `0.0` - `10.0` | &#10060; | &#10060; | &#9989; |
| `track_user_rating` | Uses the Track's user rating attribute to match<br>**Range:** `0.0` - `10.0` | &#10060; | &#10060; | &#9989; |
<sup>1</sup> You can use `current_year` to have PMM use the current years value. This can be combined with a `-#` at the end to subtract that number of years. i.e. `current-2`
## Boolean Filters
Boolean Filters take no modifier and can only be either `true` or `false`.

@ -105,7 +105,7 @@ Tag filters can take multiple values as a **list or a comma-separated string**.
| `genre` | Uses the genre tags to match | &#9989; | &#9989; | &#10060; | &#10060; | &#9989; | &#9989; | &#10060; |
| `label` | Uses the label tags to match | &#9989; | &#9989; | &#9989; | &#9989; | &#9989; | &#9989; | &#9989; |
| `producer` | Uses the actor tags to match | &#9989; | &#10060; | &#10060; | &#9989; | &#10060; | &#10060; | &#10060; |
| `year` | Uses the year tag to match | &#9989; | &#9989; | &#9989; | &#9989; | &#10060; | &#9989; | &#9989; |
| `year`<sup>3</sup> | Uses the year tag to match | &#9989; | &#9989; | &#9989; | &#9989; | &#10060; | &#9989; | &#9989; |
| `writer` | Uses the writer tags to match | &#9989; | &#10060; | &#10060; | &#9989; | &#10060; | &#10060; | &#10060; |
| `resolution` | Uses the resolution tag to match | &#9989; | &#9989;<sup>1</sup> | &#9989;<sup>1</sup> | &#9989; | &#10060; | &#10060; | &#10060; |
| `audio_language` | Uses the audio language tags to match | &#9989; | &#9989;<sup>1</sup> | &#9989;<sup>1</sup> | &#9989; | &#10060; | &#10060; | &#10060; |
@ -118,6 +118,8 @@ Tag filters can take multiple values as a **list or a comma-separated string**.
<sup>2</sup> Also filters out missing movies/shows from being added to Radarr/Sonarr. These Values also cannot use the `count` modifiers.
<sup>3</sup> You can use `current_year` to have PMM use the current years value. This can be combined with a `-#` at the end to subtract that number of years. i.e. `current-2`
## Boolean Filters
Boolean Filters have no modifiers.
@ -181,9 +183,9 @@ Number filters can **NOT** take multiple values.
### Attribute
| Number Filters | Description | Movies | Shows | Seasons | Episodes | Artists | Albums | Track |
|:------------------------------|:---------------------------------------------------------------------|:-------:|:-------------------:|:-------------------:|:--------:|:-------------------:|:-------------------:|:--------:|
| `year` | Uses the year attribute to match<br>minimum: `1` | &#9989; | &#9989; | &#9989; | &#9989; | &#10060; | &#9989; | &#9989; |
| `tmdb_year`<sup>2</sup> | Uses the year on TMDb to match<br>minimum: `1` | &#9989; | &#9989; | &#10060; | &#10060; | &#10060; | &#10060; | &#10060; |
|:------------------------------------|:---------------------------------------------------------------------|:-------:|:-------------------:|:-------------------:|:--------:|:-------------------:|:-------------------:|:--------:|
| `year`<sup>3</sup> | Uses the year attribute to match<br>minimum: `1` | &#9989; | &#9989; | &#9989; | &#9989; | &#10060; | &#9989; | &#9989; |
| `tmdb_year`<sup>2</sup><sup>3</sup> | Uses the year on TMDb to match<br>minimum: `1` | &#9989; | &#9989; | &#10060; | &#10060; | &#10060; | &#10060; | &#10060; |
| `critic_rating` | Uses the critic rating attribute to match<br>`0.0` - `10.0` | &#9989; | &#9989; | &#10060; | &#9989; | &#10060; | &#9989; | &#10060; |
| `audience_rating` | Uses the audience rating attribute to match<br> `0.0` - `10.0` | &#9989; | &#9989; | &#10060; | &#9989; | &#10060; | &#10060; | &#10060; |
| `user_rating` | Uses the user rating attribute to match<br>`0.0` - `10.0` | &#9989; | &#9989; | &#9989; | &#9989; | &#9989; | &#9989; | &#9989; |
@ -200,6 +202,8 @@ Number filters can **NOT** take multiple values.
<sup>2</sup> Also filters out missing movies/shows from being added to Radarr/Sonarr.
<sup>3</sup> You can use `current_year` to have PMM use the current years value. This can be combined with a `-#` at the end to subtract that number of years. i.e. `current-2`
## Special Filters
Special Filters each have their own set of rules for how they're used.

@ -2061,12 +2061,28 @@ class CollectionBuilder:
return datetime.strftime(datetime.now(), "%Y-%m-%d")
else:
return util.validate_date(data, final, return_as="%Y-%m-%d")
elif attribute in year_attributes and modifier in ["", ".not"]:
elif attribute in year_attributes and modifier in ["", ".not", ".gt", ".gte", ".lt", ".lte"]:
if modifier in ["", ".not"]:
final_years = []
values = util.get_list(data)
for value in values:
if str(value).startswith("current_year"):
year_values = str(value).split("-")
try:
final_years.append(datetime.now().year - (0 if len(year_values) == 1 else int(year_values[1].strip())))
except ValueError:
raise Failed(f"{self.Type} Error: {final} attribute modifier invalid '{year_values[1]}'")
else:
final_years.append(util.parse(self.Type, final, value, datatype="int"))
return smart_pair(final_years)
else:
if str(data).startswith("current_year"):
year_values = str(data).split("-")
try:
return datetime.now().year - (0 if len(year_values) == 1 else int(year_values[1].strip()))
except ValueError:
raise Failed(f"{self.Type} Error: {final} attribute modifier invalid '{year_values[1]}'")
return util.parse(self.Type, final, data, datatype="int", minimum=0)
elif attribute in date_attributes and modifier in ["", ".not"]:
search_mod = "d"
if plex_search and data and str(data)[-1] in ["s", "m", "h", "d", "w", "o", "y"]:
@ -2074,7 +2090,7 @@ class CollectionBuilder:
data = str(data)[:-1]
search_data = util.parse(self.Type, final, data, datatype="int", minimum=0)
return f"{search_data}{search_mod}" if plex_search else search_data
elif (attribute in number_attributes + year_attributes and modifier in ["", ".not", ".gt", ".gte", ".lt", ".lte"]) \
elif (attribute in number_attributes and modifier in ["", ".not", ".gt", ".gte", ".lt", ".lte"]) \
or (attribute in tag_attributes and modifier in [".count_gt", ".count_gte", ".count_lt", ".count_lte"]):
return util.parse(self.Type, final, data, datatype="int", minimum=0)
elif attribute in float_attributes and modifier in ["", ".not", ".gt", ".gte", ".lt", ".lte"]:

@ -755,12 +755,18 @@ class MetadataFile(DataFile):
number_methods = {nm.lower(): nm for nm in dynamic_data}
if "starting" in number_methods and str(dynamic_data[number_methods["starting"]]).startswith("current_year"):
year_values = str(dynamic_data[number_methods["starting"]]).split("-")
try:
starting = datetime.now().year - (0 if len(year_values) == 1 else int(year_values[1].strip()))
except ValueError:
raise Failed(f"Config Error: starting attribute modifier invalid '{year_values[1]}'")
else:
starting = util.parse("Config", "starting", dynamic_data, parent=f"{map_name} data", methods=number_methods, datatype="int", default=0, minimum=0)
if "ending" in number_methods and str(dynamic_data[number_methods["ending"]]).startswith("current_year"):
year_values = str(dynamic_data[number_methods["ending"]]).split("-")
try:
ending = datetime.now().year - (0 if len(year_values) == 1 else int(year_values[1].strip()))
except ValueError:
raise Failed(f"Config Error: ending attribute modifier invalid '{year_values[1]}'")
else:
ending = util.parse("Config", "ending", dynamic_data, parent=f"{map_name} data", methods=number_methods, datatype="int", default=0, minimum=1)
increment = util.parse("Config", "increment", dynamic_data, parent=f"{map_name} data", methods=number_methods, datatype="int", default=1, minimum=1) if "increment" in number_methods else 1

Loading…
Cancel
Save