From 4772df82aef86330b7940915c3fcb161d78d161a Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Sun, 27 Mar 2022 16:45:36 -0400 Subject: [PATCH] [35] add season_collection and episode_collection to plex search --- VERSION | 2 +- docs/metadata/builders/plex.md | 68 +++++++++++++++++---------------- docs/metadata/builders/smart.md | 68 +++++++++++++++++---------------- modules/builder.py | 3 +- modules/plex.py | 12 ++++-- 5 files changed, 82 insertions(+), 71 deletions(-) diff --git a/VERSION b/VERSION index 7fc35385..ce1755ee 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.2-develop34 +1.16.2-develop35 diff --git a/docs/metadata/builders/plex.md b/docs/metadata/builders/plex.md index a89f8d75..b39f6035 100644 --- a/docs/metadata/builders/plex.md +++ b/docs/metadata/builders/plex.md @@ -172,39 +172,41 @@ 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 | ✅ | ✅ | ❌ | -| `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 | ✅ | ✅ | ❌ | -| `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 | ❌ | ❌ | ✅ | -| `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 | ❌ | ❌ | ✅ | +| 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 | ✅ | ✅ | ❌ | +| `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 | ❌ | ❌ | ✅ | +| `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 | ❌ | ❌ | ✅ | ## Date Searches diff --git a/docs/metadata/builders/smart.md b/docs/metadata/builders/smart.md index ed002c8e..a7d19577 100644 --- a/docs/metadata/builders/smart.md +++ b/docs/metadata/builders/smart.md @@ -139,39 +139,41 @@ 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 | ✅ | ✅ | ❌ | -| `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 | ✅ | ✅ | ❌ | -| `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 | ❌ | ❌ | ✅ | -| `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 | ❌ | ❌ | ✅ | +| 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 | ✅ | ✅ | ❌ | +| `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 | ❌ | ❌ | ✅ | +| `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 | ❌ | ❌ | ✅ | ## Date Filters diff --git a/modules/builder.py b/modules/builder.py index 67c40ccf..58dcc716 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -2563,7 +2563,8 @@ class CollectionBuilder: if self.custom_sort is True: items = self.added_items else: - search_data = self.build_filter("plex_search", {"sort_by": self.custom_sort, "any": {"collection": self.name}}) + collection_type = f"{self.collection_level}_collection" if self.collection_level in ["season", "episode"] else "collection" + search_data = self.build_filter("plex_search", {"sort_by": self.custom_sort, "any": {collection_type: self.name}}) items = self.library.get_filter_items(search_data[2]) previous = None for item in items: diff --git a/modules/plex.py b/modules/plex.py index 22076105..be67bb22 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -45,6 +45,8 @@ search_translation = { "progress": "inProgress", "episode_progress": "episode.inProgress", "unplayed_episodes": "show.unwatchedLeaves", + "season_collection": "season.collection", + "episode_collection": "episode.collection", "artist_title": "artist.title", "artist_user_rating": "artist.userRating", "artist_genre": "artist.genre", @@ -191,6 +193,8 @@ searches = [ "actor", "actor.not", "audio_language", "audio_language.not", "collection", "collection.not", + "season_collection", "season_collection.not", + "episode_collection", "episode_collection.not", "content_rating", "content_rating.not", "country", "country.not", "director", "director.not", @@ -236,6 +240,8 @@ movie_only_searches = [ ] show_only_searches = [ "network", "network.not", + "season_collection", "season_collection.not", + "episode_collection", "episode_collection.not", "episode_title", "episode_title.not", "episode_title.is", "episode_title.isnot", "episode_title.begins", "episode_title.ends", "episode_added", "episode_added.not", "episode_added.before", "episode_added.after", "episode_air_date", "episode_air_date.not", @@ -266,9 +272,9 @@ number_attributes = ["plays", "episode_plays", "tmdb_vote_count", "album_plays", search_display = {"added": "Date Added", "release": "Release Date", "hdr": "HDR", "progress": "In Progress", "episode_progress": "Episode In Progress"} tag_attributes = [ "actor", "audio_language", "collection", "content_rating", "country", "director", "genre", "label", "network", - "producer", "resolution", "studio", "subtitle_language", "writer", "artist_genre", "artist_collection", - "artist_country", "artist_mood", "artist_style", "album_genre", "album_mood", "album_style", "album_format", - "album_type", "album_collection", "album_source", "album_label", "track_mood", "track_source" + "producer", "resolution", "studio", "subtitle_language", "writer", "season_collection", "episode_collection", + "artist_genre", "artist_collection", "artist_country", "artist_mood", "artist_style", "album_genre", "album_mood", + "album_style", "album_format", "album_type", "album_collection", "album_source", "album_label", "track_mood", "track_source" ] movie_sorts = { "title.asc": "titleSort", "title.desc": "titleSort%3Adesc",