From 3ce529014f6037d885a8834b30f694a9e1ab6c6e Mon Sep 17 00:00:00 2001 From: YozoraXCII <96386153+YozoraXCII@users.noreply.github.com> Date: Sat, 19 Aug 2023 16:30:47 +0100 Subject: [PATCH] Add ability to filter for subtitle track title --- docs/metadata/filters.md | 1 + modules/builder.py | 6 +++--- modules/plex.py | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/metadata/filters.md b/docs/metadata/filters.md index 0f572aa6..b3122b68 100644 --- a/docs/metadata/filters.md +++ b/docs/metadata/filters.md @@ -77,6 +77,7 @@ String filters can take multiple values **only as a list**. | `folder` | Uses the item's folder to match | ❌ | ✅ | ❌ | ❌ | ✅ | ❌ | ❌ | | `filepath` | Uses the item's filepath to match | ✅ | ✅**[1](#table-annotations)** | ✅**[1](#table-annotations)** | ✅ | ✅**[1](#table-annotations)** | ✅**[1](#table-annotations)** | ✅ | | `audio_track_title` | Uses the audio track titles to match | ✅ | ✅**[1](#table-annotations)** | ✅**[1](#table-annotations)** | ✅ | ✅**[1](#table-annotations)** | ✅**[1](#table-annotations)** | ✅ | +| `subtitle_track_title` | Uses the subtitle track titles to match | ✅ | ✅**[1](#table-annotations)** | ✅**[1](#table-annotations)** | ✅ | ✅**[1](#table-annotations)** | ✅**[1](#table-annotations)** | ✅ | | `video_codec` | Uses the video codec tags to match | ✅ | ✅**[1](#table-annotations)** | ✅**[1](#table-annotations)** | ✅ | ❌ | ❌ | ❌ | | `video_profile` | Uses the video profile tags to match | ✅ | ✅**[1](#table-annotations)** | ✅**[1](#table-annotations)** | ✅ | ❌ | ❌ | ❌ | | `audio_codec` | Uses the audio codec tags to match | ✅ | ✅**[1](#table-annotations)** | ✅**[1](#table-annotations)** | ✅ | ❌ | ❌ | ❌ | diff --git a/modules/builder.py b/modules/builder.py index a880b409..e62b41ac 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -67,11 +67,11 @@ sonarr_details = [ ] album_details = ["non_item_remove_label", "item_label", "item_album_sorting"] sub_filters = [ - "filepath", "audio_track_title", "resolution", "audio_language", "subtitle_language", "has_dolby_vision", + "filepath", "audio_track_title", "subtitle_track_title", "resolution", "audio_language", "subtitle_language", "has_dolby_vision", "channels", "height", "width", "aspect", "audio_codec", "audio_profile", "video_codec", "video_profile", "versions" ] filters_by_type = { - "movie_show_season_episode_artist_album_track": ["title", "summary", "collection", "has_collection", "added", "last_played", "user_rating", "plays", "filepath", "label", "audio_track_title", "versions"], + "movie_show_season_episode_artist_album_track": ["title", "summary", "collection", "has_collection", "added", "last_played", "user_rating", "plays", "filepath", "label", "audio_track_title", "subtitle_track_title", "versions"], "movie_show_season_episode_album_track": ["year"], "movie_show_season_episode_artist_album": ["has_overlay"], "movie_show_season_episode": ["resolution", "audio_language", "subtitle_language", "has_dolby_vision", "channels", "height", "width", "aspect", "audio_codec", "audio_profile", "video_codec", "video_profile"], @@ -105,7 +105,7 @@ tmdb_filters = [ ] imdb_filters = ["imdb_keyword"] string_filters = [ - "title", "summary", "studio", "edition", "record_label", "folder", "filepath", "audio_track_title", "tmdb_title", + "title", "summary", "studio", "edition", "record_label", "folder", "filepath", "audio_track_title", "subtitle_track_title", "tmdb_title", "audio_codec", "audio_profile", "video_codec", "video_profile" ] string_modifiers = ["", ".not", ".is", ".isnot", ".begins", ".ends", ".regex"] diff --git a/modules/plex.py b/modules/plex.py index 5af6161f..0aa48069 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -1594,6 +1594,10 @@ class Plex(Library): for media in item.media: for part in media.parts: values.extend([a.extendedDisplayTitle for a in part.audioStreams() if a.extendedDisplayTitle]) + elif filter_attr == "subtitle_track_title": + for media in item.media: + for part in media.parts: + values.extend([a.extendedDisplayTitle for a in part.subtitleStreams() if a.extendedDisplayTitle]) elif filter_attr in ["audio_codec", "audio_profile", "video_codec", "video_profile"]: for media in item.media: attr = getattr(media, filter_actual)