From 1ec4a9bebb1dacd54d5a17c4b8ddfebf5d1a0eb3 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 8 Nov 2022 02:02:11 -0500 Subject: [PATCH] [190] #1143 add current_year to plex_search, smart_filter, and filters year attributes --- CHANGELOG | 1 + VERSION | 2 +- docs/defaults/overlays.md | 4 +- docs/metadata/builders/plex.md | 126 ++++++++++++++++---------------- docs/metadata/builders/smart.md | 122 ++++++++++++++++--------------- docs/metadata/filters.md | 36 +++++---- modules/builder.py | 30 ++++++-- modules/meta.py | 10 ++- 8 files changed, 183 insertions(+), 148 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 518a4439..89bb01c9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) diff --git a/VERSION b/VERSION index 8ae3da3f..8769b9df 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.3-develop189 +1.17.3-develop190 diff --git a/docs/defaults/overlays.md b/docs/defaults/overlays.md index 42ccf176..53864247 100644 --- a/docs/defaults/overlays.md +++ b/docs/defaults/overlays.md @@ -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 ``` \ No newline at end of file diff --git a/docs/metadata/builders/plex.md b/docs/metadata/builders/plex.md index 20dd15d4..86e32335 100644 --- a/docs/metadata/builders/plex.md +++ b/docs/metadata/builders/plex.md @@ -210,45 +210,47 @@ Tag search can take multiple values as a **list or a comma-separated string**. ### Tag Attributes -| Tag Search | Description | Movie
Libraries | Show
Libraries | Music
Libraries | -|:---------------------|:----------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:| -| `actor` | Uses the actor tags to match | ✅ | ✅ | ❌ | -| `audio_language` | Uses the audio language tags to match | ✅ | ✅ | ❌ | -| `collection` | Uses the collection tags to match for top level collections | ✅ | ✅ | ❌ | -| `season_collection` | Uses the collection tags to match for season collections | ❌ | ✅ | ❌ | -| `episode_collection` | Uses the collection tags to match for episode collections | ❌ | ✅ | ❌ | -| `content_rating` | Uses the content rating tags to match | ✅ | ✅ | ❌ | -| `country` | Uses the country tags to match | ✅ | ❌ | ❌ | -| `decade` | Uses the year tag to match the decade | ✅ | ❌ | ❌ | -| `director` | Uses the director tags to match | ✅ | ❌ | ❌ | -| `genre` | Uses the genre tags to match | ✅ | ✅ | ❌ | -| `label` | Uses the label tags to match for top level collections | ✅ | ✅ | ❌ | -| `season_label` | Uses the label tags to match for season collections | ❌ | ✅ | ❌ | -| `episode_label` | Uses the label tags to match for episode collections | ❌ | ✅ | ❌ | -| `network` | Uses the network tags to match
**Only works with the New Plex TV Agent** | ❌ | ✅ | ❌ | -| `producer` | Uses the actor tags to match | ✅ | ❌ | ❌ | -| `resolution` | Uses the resolution tags to match | ✅ | ✅ | ❌ | -| `subtitle_language` | Uses the subtitle language tags to match | ✅ | ✅ | ❌ | -| `writer` | Uses the writer tags to match | ✅ | ❌ | ❌ | -| `year` | Uses the year tag to match | ✅ | ✅ | ❌ | -| `episode_year` | Uses the year tag to match | ❌ | ✅ | ❌ | -| `artist_genre` | Uses the Artist's Genre attribute to match | ❌ | ❌ | ✅ | -| `artist_collection` | Uses the Artist's Collection attribute to match | ❌ | ❌ | ✅ | -| `artist_country` | Uses the Artist's Country attribute to match | ❌ | ❌ | ✅ | -| `artist_mood` | Uses the Artist's Mood attribute to match | ❌ | ❌ | ✅ | -| `artist_style` | Uses the Artist's Style attribute to match | ❌ | ❌ | ✅ | -| `artist_label` | Uses the Artist's Label attribute to match | ❌ | ❌ | ✅ | -| `album_genre` | Uses the Album's Genre attribute to match | ❌ | ❌ | ✅ | -| `album_mood` | Uses the Album's Mood attribute to match | ❌ | ❌ | ✅ | -| `album_style` | Uses the Album's Style attribute to match | ❌ | ❌ | ✅ | -| `album_format` | Uses the Album's Format attribute to match | ❌ | ❌ | ✅ | -| `album_type` | Uses the Album's Type attribute to match | ❌ | ❌ | ✅ | -| `album_collection` | Uses the Album's Collection attribute to match | ❌ | ❌ | ✅ | -| `album_source` | Uses the Album's Source attribute to match | ❌ | ❌ | ✅ | -| `album_label` | Uses the Album's Label attribute to match | ❌ | ❌ | ✅ | -| `track_mood` | Uses the Track's Mood attribute to match | ❌ | ❌ | ✅ | -| `track_source` | Uses the Track's Style attribute to match | ❌ | ❌ | ✅ | -| `track_label` | Uses the Track's Label attribute to match | ❌ | ❌ | ✅ | +| Tag Search | Description | Movie
Libraries | Show
Libraries | Music
Libraries | +|:---------------------------|:----------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:| +| `actor` | Uses the actor tags to match | ✅ | ✅ | ❌ | +| `audio_language` | Uses the audio language tags to match | ✅ | ✅ | ❌ | +| `collection` | Uses the collection tags to match for top level collections | ✅ | ✅ | ❌ | +| `season_collection` | Uses the collection tags to match for season collections | ❌ | ✅ | ❌ | +| `episode_collection` | Uses the collection tags to match for episode collections | ❌ | ✅ | ❌ | +| `content_rating` | Uses the content rating tags to match | ✅ | ✅ | ❌ | +| `country` | Uses the country tags to match | ✅ | ❌ | ❌ | +| `decade`1 | Uses the year tag to match the decade | ✅ | ❌ | ❌ | +| `director` | Uses the director tags to match | ✅ | ❌ | ❌ | +| `genre` | Uses the genre tags to match | ✅ | ✅ | ❌ | +| `label` | Uses the label tags to match for top level collections | ✅ | ✅ | ❌ | +| `season_label` | Uses the label tags to match for season collections | ❌ | ✅ | ❌ | +| `episode_label` | Uses the label tags to match for episode collections | ❌ | ✅ | ❌ | +| `network` | Uses the network tags to match
**Only works with the New Plex TV Agent** | ❌ | ✅ | ❌ | +| `producer` | Uses the actor tags to match | ✅ | ❌ | ❌ | +| `resolution` | Uses the resolution tags to match | ✅ | ✅ | ❌ | +| `subtitle_language` | Uses the subtitle language tags to match | ✅ | ✅ | ❌ | +| `writer` | Uses the writer tags to match | ✅ | ❌ | ❌ | +| `year`1 | Uses the year tag to match | ✅ | ✅ | ❌ | +| `episode_year`1 | Uses the year tag to match | ❌ | ✅ | ❌ | +| `artist_genre` | Uses the Artist's Genre attribute to match | ❌ | ❌ | ✅ | +| `artist_collection` | Uses the Artist's Collection attribute to match | ❌ | ❌ | ✅ | +| `artist_country` | Uses the Artist's Country attribute to match | ❌ | ❌ | ✅ | +| `artist_mood` | Uses the Artist's Mood attribute to match | ❌ | ❌ | ✅ | +| `artist_style` | Uses the Artist's Style attribute to match | ❌ | ❌ | ✅ | +| `artist_label` | Uses the Artist's Label attribute to match | ❌ | ❌ | ✅ | +| `album_genre` | Uses the Album's Genre attribute to match | ❌ | ❌ | ✅ | +| `album_mood` | Uses the Album's Mood attribute to match | ❌ | ❌ | ✅ | +| `album_style` | Uses the Album's Style attribute to match | ❌ | ❌ | ✅ | +| `album_format` | Uses the Album's Format attribute to match | ❌ | ❌ | ✅ | +| `album_type` | Uses the Album's Type attribute to match | ❌ | ❌ | ✅ | +| `album_collection` | Uses the Album's Collection attribute to match | ❌ | ❌ | ✅ | +| `album_source` | Uses the Album's Source attribute to match | ❌ | ❌ | ✅ | +| `album_label` | Uses the Album's Label attribute to match | ❌ | ❌ | ✅ | +| `track_mood` | Uses the Track's Mood attribute to match | ❌ | ❌ | ✅ | +| `track_source` | Uses the Track's Style attribute to match | ❌ | ❌ | ✅ | +| `track_label` | Uses the Track's Label attribute to match | ❌ | ❌ | ✅ | + +1 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 @@ -305,28 +307,30 @@ No number search can take multiple values. ### Number Attributes -| Number Search | Description | Movie
Libraries | Show
Libraries | Music
Libraries | -|:--------------------------|:------------------------------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:| -| `duration` | Uses the duration attribute to match using minutes
**Minimum:** `0` | ✅ | ❌ | ❌ | -| `plays` | Uses the plays attribute to match
**Minimum:** `0` | ✅ | ✅ | ❌ | -| `episode_plays` | Uses the Episode's plays attribute to match
**Minimum:** `0` | ❌ | ✅ | ❌ | -| `critic_rating` | Uses the critic rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | -| `audience_rating` | Uses the audience rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | -| `user_rating` | Uses the user rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | -| `episode_user_rating` | Uses the user rating attribute of the show's episodes to match
**Range:** `0.0` - `10.0` | ❌ | ✅ | ❌ | -| `episode_critic_rating` | Uses the critic rating attribute of the show's episodes to match
**Range:** `0.0` - `10.0` | ❌ | ✅ | ❌ | -| `episode_audience_rating` | Uses the audience rating attribute of the show's episodes to match
**Range:** `0.0` - `10.0` | ❌ | ✅ | ❌ | -| `year` | Uses the year attribute to match
**Minimum:** `0` | ✅ | ✅ | ❌ | -| `episode_year` | Uses the Episode's year attribute to match
**Minimum:** `0` | ❌ | ✅ | ❌ | -| `album_year` | Uses the Album's year attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | -| `album_decade` | Uses the Album's decade attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | -| `album_plays` | Uses the Album's plays attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | -| `track_plays` | Uses the Track's plays attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | -| `track_skips` | Uses the Track's skips attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | -| `artist_user_rating` | Uses the Artist's user rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | -| `album_user_rating` | Uses the Album's user rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | -| `album_critic_rating` | Uses the Album's critic rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | -| `track_user_rating` | Uses the Track's user rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | +| Number Search | Description | Movie
Libraries | Show
Libraries | Music
Libraries | +|:---------------------------|:------------------------------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:| +| `duration` | Uses the duration attribute to match using minutes
**Minimum:** `0` | ✅ | ❌ | ❌ | +| `plays` | Uses the plays attribute to match
**Minimum:** `0` | ✅ | ✅ | ❌ | +| `episode_plays` | Uses the Episode's plays attribute to match
**Minimum:** `0` | ❌ | ✅ | ❌ | +| `critic_rating` | Uses the critic rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | +| `audience_rating` | Uses the audience rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | +| `user_rating` | Uses the user rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | +| `episode_user_rating` | Uses the user rating attribute of the show's episodes to match
**Range:** `0.0` - `10.0` | ❌ | ✅ | ❌ | +| `episode_critic_rating` | Uses the critic rating attribute of the show's episodes to match
**Range:** `0.0` - `10.0` | ❌ | ✅ | ❌ | +| `episode_audience_rating` | Uses the audience rating attribute of the show's episodes to match
**Range:** `0.0` - `10.0` | ❌ | ✅ | ❌ | +| `year`1 | Uses the year attribute to match
**Minimum:** `0` | ✅ | ✅ | ❌ | +| `episode_year`1 | Uses the Episode's year attribute to match
**Minimum:** `0` | ❌ | ✅ | ❌ | +| `album_year`1 | Uses the Album's year attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `album_decade`1 | Uses the Album's decade attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `album_plays` | Uses the Album's plays attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `track_plays` | Uses the Track's plays attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `track_skips` | Uses the Track's skips attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `artist_user_rating` | Uses the Artist's user rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | +| `album_user_rating` | Uses the Album's user rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | +| `album_critic_rating` | Uses the Album's critic rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | +| `track_user_rating` | Uses the Track's user rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | + +1 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 diff --git a/docs/metadata/builders/smart.md b/docs/metadata/builders/smart.md index db720a40..279c763b 100644 --- a/docs/metadata/builders/smart.md +++ b/docs/metadata/builders/smart.md @@ -144,45 +144,47 @@ Tag filter can take multiple values as a **list or a comma-separated string**. ### Tag Attributes -| Tag Search | Description | Movie
Libraries | Show
Libraries | Music
Libraries | -|:---------------------|:----------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:| -| `actor` | Uses the actor tags to match | ✅ | ✅ | ❌ | -| `audio_language` | Uses the audio language tags to match | ✅ | ✅ | ❌ | -| `collection` | Uses the collection tags to match for top level collections | ✅ | ✅ | ❌ | -| `season_collection` | Uses the collection tags to match for season collections | ❌ | ✅ | ❌ | -| `episode_collection` | Uses the collection tags to match for episode collections | ❌ | ✅ | ❌ | -| `content_rating` | Uses the content rating tags to match | ✅ | ✅ | ❌ | -| `country` | Uses the country tags to match | ✅ | ❌ | ❌ | -| `decade` | Uses the year tag to match the decade | ✅ | ❌ | ❌ | -| `director` | Uses the director tags to match | ✅ | ❌ | ❌ | -| `genre` | Uses the genre tags to match | ✅ | ✅ | ❌ | -| `label` | Uses the label tags to match for top level collections | ✅ | ✅ | ❌ | -| `season_label` | Uses the label tags to match for season collections | ❌ | ✅ | ❌ | -| `episode_label` | Uses the label tags to match for episode collections | ❌ | ✅ | ❌ | -| `network` | Uses the network tags to match
**Only works with the New Plex TV Agent** | ❌ | ✅ | ❌ | -| `producer` | Uses the actor tags to match | ✅ | ❌ | ❌ | -| `resolution` | Uses the resolution tags to match | ✅ | ✅ | ❌ | -| `subtitle_language` | Uses the subtitle language tags to match | ✅ | ✅ | ❌ | -| `writer` | Uses the writer tags to match | ✅ | ❌ | ❌ | -| `year` | Uses the year tag to match | ✅ | ✅ | ❌ | -| `episode_year` | Uses the year tag to match | ❌ | ✅ | ❌ | -| `artist_genre` | Uses the Artist's Genre attribute to match | ❌ | ❌ | ✅ | -| `artist_collection` | Uses the Artist's Collection attribute to match | ❌ | ❌ | ✅ | -| `artist_country` | Uses the Artist's Country attribute to match | ❌ | ❌ | ✅ | -| `artist_mood` | Uses the Artist's Mood attribute to match | ❌ | ❌ | ✅ | -| `artist_style` | Uses the Artist's Style attribute to match | ❌ | ❌ | ✅ | -| `artist_label` | Uses the Artist's Label attribute to match | ❌ | ❌ | ✅ | -| `album_genre` | Uses the Album's Genre attribute to match | ❌ | ❌ | ✅ | -| `album_mood` | Uses the Album's Mood attribute to match | ❌ | ❌ | ✅ | -| `album_style` | Uses the Album's Style attribute to match | ❌ | ❌ | ✅ | -| `album_format` | Uses the Album's Format attribute to match | ❌ | ❌ | ✅ | -| `album_type` | Uses the Album's Type attribute to match | ❌ | ❌ | ✅ | -| `album_collection` | Uses the Album's Collection attribute to match | ❌ | ❌ | ✅ | -| `album_source` | Uses the Album's Source attribute to match | ❌ | ❌ | ✅ | -| `album_label` | Uses the Album's Label attribute to match | ❌ | ❌ | ✅ | -| `track_mood` | Uses the Track's Mood attribute to match | ❌ | ❌ | ✅ | -| `track_source` | Uses the Track's Style attribute to match | ❌ | ❌ | ✅ | -| `track_label` | Uses the Track's Label attribute to match | ❌ | ❌ | ✅ | +| Tag Search | Description | Movie
Libraries | Show
Libraries | Music
Libraries | +|:---------------------------|:----------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:| +| `actor` | Uses the actor tags to match | ✅ | ✅ | ❌ | +| `audio_language` | Uses the audio language tags to match | ✅ | ✅ | ❌ | +| `collection` | Uses the collection tags to match for top level collections | ✅ | ✅ | ❌ | +| `season_collection` | Uses the collection tags to match for season collections | ❌ | ✅ | ❌ | +| `episode_collection` | Uses the collection tags to match for episode collections | ❌ | ✅ | ❌ | +| `content_rating` | Uses the content rating tags to match | ✅ | ✅ | ❌ | +| `country` | Uses the country tags to match | ✅ | ❌ | ❌ | +| `decade`1 | Uses the year tag to match the decade | ✅ | ❌ | ❌ | +| `director` | Uses the director tags to match | ✅ | ❌ | ❌ | +| `genre` | Uses the genre tags to match | ✅ | ✅ | ❌ | +| `label` | Uses the label tags to match for top level collections | ✅ | ✅ | ❌ | +| `season_label` | Uses the label tags to match for season collections | ❌ | ✅ | ❌ | +| `episode_label` | Uses the label tags to match for episode collections | ❌ | ✅ | ❌ | +| `network` | Uses the network tags to match
**Only works with the New Plex TV Agent** | ❌ | ✅ | ❌ | +| `producer` | Uses the actor tags to match | ✅ | ❌ | ❌ | +| `resolution` | Uses the resolution tags to match | ✅ | ✅ | ❌ | +| `subtitle_language` | Uses the subtitle language tags to match | ✅ | ✅ | ❌ | +| `writer` | Uses the writer tags to match | ✅ | ❌ | ❌ | +| `year`1 | Uses the year tag to match | ✅ | ✅ | ❌ | +| `episode_year`1 | Uses the year tag to match | ❌ | ✅ | ❌ | +| `artist_genre` | Uses the Artist's Genre attribute to match | ❌ | ❌ | ✅ | +| `artist_collection` | Uses the Artist's Collection attribute to match | ❌ | ❌ | ✅ | +| `artist_country` | Uses the Artist's Country attribute to match | ❌ | ❌ | ✅ | +| `artist_mood` | Uses the Artist's Mood attribute to match | ❌ | ❌ | ✅ | +| `artist_style` | Uses the Artist's Style attribute to match | ❌ | ❌ | ✅ | +| `artist_label` | Uses the Artist's Label attribute to match | ❌ | ❌ | ✅ | +| `album_genre` | Uses the Album's Genre attribute to match | ❌ | ❌ | ✅ | +| `album_mood` | Uses the Album's Mood attribute to match | ❌ | ❌ | ✅ | +| `album_style` | Uses the Album's Style attribute to match | ❌ | ❌ | ✅ | +| `album_format` | Uses the Album's Format attribute to match | ❌ | ❌ | ✅ | +| `album_type` | Uses the Album's Type attribute to match | ❌ | ❌ | ✅ | +| `album_collection` | Uses the Album's Collection attribute to match | ❌ | ❌ | ✅ | +| `album_source` | Uses the Album's Source attribute to match | ❌ | ❌ | ✅ | +| `album_label` | Uses the Album's Label attribute to match | ❌ | ❌ | ✅ | +| `track_mood` | Uses the Track's Mood attribute to match | ❌ | ❌ | ✅ | +| `track_source` | Uses the Track's Style attribute to match | ❌ | ❌ | ✅ | +| `track_label` | Uses the Track's Label attribute to match | ❌ | ❌ | ✅ | + +1 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 @@ -239,26 +241,28 @@ No number filter can take multiple values. ### Number Attributes -| Number Search | Description | Movie
Libraries | Show
Libraries | Music
Libraries | -|:----------------------|:--------------------------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:| -| `duration` | Uses the duration attribute to match using minutes
**Minimum:** `0` | ✅ | ❌ | ❌ | -| `plays` | Uses the plays attribute to match
**Minimum:** `0` | ✅ | ✅ | ❌ | -| `episode_plays` | Uses the Episode's plays attribute to match
**Minimum:** `0` | ❌ | ✅ | ❌ | -| `critic_rating` | Uses the critic rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | -| `audience_rating` | Uses the audience rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | -| `user_rating` | Uses the user rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | -| `episode_user_rating` | Uses the user rating attribute of the show's episodes to match
**Range:** `0.0` - `10.0` | ❌ | ✅ | ❌ | -| `year` | Uses the year attribute to match
**Minimum:** `0` | ✅ | ✅ | ❌ | -| `episode_year` | Uses the Episode's year attribute to match
**Minimum:** `0` | ❌ | ✅ | ❌ | -| `album_year` | Uses the Album's year attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | -| `album_decade` | Uses the Album's decade attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | -| `album_plays` | Uses the Album's plays attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | -| `track_plays` | Uses the Track's plays attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | -| `track_skips` | Uses the Track's skips attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | -| `artist_user_rating` | Uses the Artist's user rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | -| `album_user_rating` | Uses the Album's user rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | -| `album_critic_rating` | Uses the Album's critic rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | -| `track_user_rating` | Uses the Track's user rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | +| Number Search | Description | Movie
Libraries | Show
Libraries | Music
Libraries | +|:---------------------------|:--------------------------------------------------------------------------------------------|:------------------:|:-----------------:|:------------------:| +| `duration` | Uses the duration attribute to match using minutes
**Minimum:** `0` | ✅ | ❌ | ❌ | +| `plays` | Uses the plays attribute to match
**Minimum:** `0` | ✅ | ✅ | ❌ | +| `episode_plays` | Uses the Episode's plays attribute to match
**Minimum:** `0` | ❌ | ✅ | ❌ | +| `critic_rating` | Uses the critic rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | +| `audience_rating` | Uses the audience rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | +| `user_rating` | Uses the user rating attribute to match
**Range:** `0.0` - `10.0` | ✅ | ✅ | ❌ | +| `episode_user_rating` | Uses the user rating attribute of the show's episodes to match
**Range:** `0.0` - `10.0` | ❌ | ✅ | ❌ | +| `year`1 | Uses the year attribute to match
**Minimum:** `0` | ✅ | ✅ | ❌ | +| `episode_year`1 | Uses the Episode's year attribute to match
**Minimum:** `0` | ❌ | ✅ | ❌ | +| `album_year`1 | Uses the Album's year attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `album_decade`1 | Uses the Album's decade attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `album_plays` | Uses the Album's plays attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `track_plays` | Uses the Track's plays attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `track_skips` | Uses the Track's skips attribute to match
**Minimum:** `0` | ❌ | ❌ | ✅ | +| `artist_user_rating` | Uses the Artist's user rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | +| `album_user_rating` | Uses the Album's user rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | +| `album_critic_rating` | Uses the Album's critic rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | +| `track_user_rating` | Uses the Track's user rating attribute to match
**Range:** `0.0` - `10.0` | ❌ | ❌ | ✅ | + +1 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 diff --git a/docs/metadata/filters.md b/docs/metadata/filters.md index 68403c76..7e51040b 100644 --- a/docs/metadata/filters.md +++ b/docs/metadata/filters.md @@ -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 | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ | ❌ | | `label` | Uses the label tags to match | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | `producer` | Uses the actor tags to match | ✅ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | -| `year` | Uses the year tag to match | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | +| `year`3 | Uses the year tag to match | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | | `writer` | Uses the writer tags to match | ✅ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | | `resolution` | Uses the resolution tag to match | ✅ | ✅1 | ✅1 | ✅ | ❌ | ❌ | ❌ | | `audio_language` | Uses the audio language tags to match | ✅ | ✅1 | ✅1 | ✅ | ❌ | ❌ | ❌ | @@ -118,6 +118,8 @@ Tag filters can take multiple values as a **list or a comma-separated string**. 2 Also filters out missing movies/shows from being added to Radarr/Sonarr. These Values also cannot use the `count` modifiers. +3 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. @@ -180,26 +182,28 @@ 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
minimum: `1` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | -| `tmdb_year`2 | Uses the year on TMDb to match
minimum: `1` | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | -| `critic_rating` | Uses the critic rating attribute to match
`0.0` - `10.0` | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ | ❌ | -| `audience_rating` | Uses the audience rating attribute to match
`0.0` - `10.0` | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ | -| `user_rating` | Uses the user rating attribute to match
`0.0` - `10.0` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `tmdb_vote_count`2 | Uses the tmdb vote count to match
minimum: `1` | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | -| `plays` | Uses the plays attribute to match
minimum: `1` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| `duration` | Uses the duration attribute to match using minutes
minimum: `0.0` | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ | -| `channels` | Uses the audio channels attribute to match
minimum: `0` | ✅ | ✅1 | ✅1 | ✅ | ❌ | ❌ | ❌ | -| `height` | Uses the height attribute to match
minimum: `0` | ✅ | ✅1 | ✅1 | ✅ | ❌ | ❌ | ❌ | -| `width` | Uses the width attribute to match
minimum: `0` | ✅ | ✅1 | ✅1 | ✅ | ❌ | ❌ | ❌ | -| `aspect` | Uses the aspect attribute to match
minimum: `0.0` | ✅ | ✅1 | ✅1 | ✅ | ❌ | ❌ | ❌ | -| `versions` | Uses the number of versions found to match
minimum: `0` | ✅ | ✅1 | ✅1 | ✅ | ✅1 | ✅1 | ✅ | +| Number Filters | Description | Movies | Shows | Seasons | Episodes | Artists | Albums | Track | +|:------------------------------------|:---------------------------------------------------------------------|:-------:|:-------------------:|:-------------------:|:--------:|:-------------------:|:-------------------:|:--------:| +| `year`3 | Uses the year attribute to match
minimum: `1` | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | +| `tmdb_year`23 | Uses the year on TMDb to match
minimum: `1` | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | +| `critic_rating` | Uses the critic rating attribute to match
`0.0` - `10.0` | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ | ❌ | +| `audience_rating` | Uses the audience rating attribute to match
`0.0` - `10.0` | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ | +| `user_rating` | Uses the user rating attribute to match
`0.0` - `10.0` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| `tmdb_vote_count`2 | Uses the tmdb vote count to match
minimum: `1` | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | +| `plays` | Uses the plays attribute to match
minimum: `1` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| `duration` | Uses the duration attribute to match using minutes
minimum: `0.0` | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ | +| `channels` | Uses the audio channels attribute to match
minimum: `0` | ✅ | ✅1 | ✅1 | ✅ | ❌ | ❌ | ❌ | +| `height` | Uses the height attribute to match
minimum: `0` | ✅ | ✅1 | ✅1 | ✅ | ❌ | ❌ | ❌ | +| `width` | Uses the width attribute to match
minimum: `0` | ✅ | ✅1 | ✅1 | ✅ | ❌ | ❌ | ❌ | +| `aspect` | Uses the aspect attribute to match
minimum: `0.0` | ✅ | ✅1 | ✅1 | ✅ | ❌ | ❌ | ❌ | +| `versions` | Uses the number of versions found to match
minimum: `0` | ✅ | ✅1 | ✅1 | ✅ | ✅1 | ✅1 | ✅ | 1 Filters using the special `episodes` [filter](#special-filters) with the [default percent](details/definition). 2 Also filters out missing movies/shows from being added to Radarr/Sonarr. +3 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. diff --git a/modules/builder.py b/modules/builder.py index e7014bde..8d5502c9 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -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"]: - final_years = [] - values = util.get_list(data) - for value in values: - final_years.append(util.parse(self.Type, final, value, datatype="int")) - return smart_pair(final_years) + 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"]: diff --git a/modules/meta.py b/modules/meta.py index 3948352f..806c491e 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -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("-") - starting = datetime.now().year - (0 if len(year_values) == 1 else int(year_values[1].strip())) + 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("-") - ending = datetime.now().year - (0 if len(year_values) == 1 else int(year_values[1].strip())) + 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