diff options
author | JayZed <[email protected]> | 2024-08-28 14:30:00 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2024-08-28 14:30:00 -0400 |
commit | e5f1528bbad2d0df8d0ed32b16cfa6856db79f2c (patch) | |
tree | c7a55bc92f1c38c06287c245cdb1b503275711e1 | |
parent | f1f3850f9e0f30403f87a359143dfe366b479e37 (diff) | |
download | bazarr-1.4.4-beta.37.tar.gz bazarr-1.4.4-beta.37.zip |
Added ability to remove language profiles based on tag valuesv1.4.4-beta.37
-rw-r--r-- | bazarr/app/config.py | 2 | ||||
-rw-r--r-- | bazarr/radarr/sync/parser.py | 4 | ||||
-rw-r--r-- | bazarr/sonarr/sync/parser.py | 6 | ||||
-rw-r--r-- | frontend/src/pages/Settings/Languages/index.tsx | 28 | ||||
-rw-r--r-- | frontend/src/types/settings.d.ts | 1 |
5 files changed, 38 insertions, 3 deletions
diff --git a/bazarr/app/config.py b/bazarr/app/config.py index 5e5b5ac04..73ed05e7c 100644 --- a/bazarr/app/config.py +++ b/bazarr/app/config.py @@ -96,6 +96,7 @@ validators = [ Validator('general.path_mappings_movie', must_exist=True, default=[], is_type_of=list), Validator('general.serie_tag_enabled', must_exist=True, default=False, is_type_of=bool), Validator('general.movie_tag_enabled', must_exist=True, default=False, is_type_of=bool), + Validator('general.remove_profile_tags', must_exist=True, default=[], is_type_of=list, condition=validate_tags), Validator('general.serie_default_enabled', must_exist=True, default=False, is_type_of=bool), Validator('general.serie_default_profile', must_exist=True, default='', is_type_of=(int, str)), Validator('general.movie_default_enabled', must_exist=True, default=False, is_type_of=bool), @@ -468,6 +469,7 @@ array_keys = ['excluded_tags', 'enabled_integrations', 'path_mappings', 'path_mappings_movie', + 'remove_profile_tags', 'language_equals', 'blacklisted_languages', 'blacklisted_providers'] diff --git a/bazarr/radarr/sync/parser.py b/bazarr/radarr/sync/parser.py index 11b2a6687..60aad85a5 100644 --- a/bazarr/radarr/sync/parser.py +++ b/bazarr/radarr/sync/parser.py @@ -152,6 +152,10 @@ def movieParser(movie, action, tags_dict, language_profiles, movie_default_profi tag_profile = get_matching_profile(tags, language_profiles) if tag_profile: parsed_movie['profileId'] = tag_profile + remove_profile_tags_list = settings.general.remove_profile_tags + if len(remove_profile_tags_list) > 0: + if set(tags) & set(remove_profile_tags_list): + parsed_movie['profileId'] = None return parsed_movie diff --git a/bazarr/sonarr/sync/parser.py b/bazarr/sonarr/sync/parser.py index 24c92c575..216a9d1f5 100644 --- a/bazarr/sonarr/sync/parser.py +++ b/bazarr/sonarr/sync/parser.py @@ -78,7 +78,11 @@ def seriesParser(show, action, tags_dict, language_profiles, serie_default_profi tag_profile = get_matching_profile(tags, language_profiles) if tag_profile: parsed_series['profileId'] = tag_profile - + remove_profile_tags_list = settings.general.remove_profile_tags + if len(remove_profile_tags_list) > 0: + if set(tags) & set(remove_profile_tags_list): + parsed_series['profileId'] = None + return parsed_series diff --git a/frontend/src/pages/Settings/Languages/index.tsx b/frontend/src/pages/Settings/Languages/index.tsx index 6a5b5309b..1bd9d72a8 100644 --- a/frontend/src/pages/Settings/Languages/index.tsx +++ b/frontend/src/pages/Settings/Languages/index.tsx @@ -1,7 +1,9 @@ import { FunctionComponent } from "react"; +import { Text as MantineText } from "@mantine/core"; import { useLanguageProfiles, useLanguages } from "@/apis/hooks"; import { Check, + Chips, CollapseBox, Layout, Message, @@ -121,12 +123,21 @@ const SettingsLanguagesView: FunctionComponent = () => { Sonarr (or a Movie from Radarr) to find a matching Bazarr language profile tag. It will use as the language profile the FIRST tag from Sonarr/Radarr that matches the tag of a Bazarr language profile - EXACTLY. If mutiple tags match, there is no guarantee as to which one + EXACTLY. If multiple tags match, there is no guarantee as to which one will be used, so choose your tag names carefully. Also, if you update the tag names in Sonarr/Radarr, Bazarr will detect this and repeat the matching process for the affected shows. However, if a show's only matching tag is removed from Sonarr/Radarr, Bazarr will NOT remove the - show's existing language profile, but keep it, as is. + show's existing language profile for that reason. But if you wish to + have language profiles removed automatically by tag value, simply + enter a list of one or more tags in the{" "} + <MantineText fw={700} span> + Remove Profile Tags + </MantineText>{" "} + entry list below. If your video tag matches one of the tags in that + list, then Bazarr will remove the language profile for that video. If + there is a conflict between profile selection and profile removal, + then profile removal wins out and is performed. </Message> <Check label="Series" @@ -136,6 +147,19 @@ const SettingsLanguagesView: FunctionComponent = () => { label="Movies" settingKey="settings-general-movie_tag_enabled" ></Check> + <Chips + label="Remove Profile Tags" + settingKey="settings-general-remove_profile_tags" + sanitizeFn={(values: string[] | null) => + values?.map((item) => + item.replace(/[^a-z0-9_-]/gi, "").toLowerCase(), + ) + } + ></Chips> + <Message> + Enter tag values that will trigger a language profile removal. Leave + empty if you don't want Bazarr to remove language profiles. + </Message> </Section> <Section header="Default Settings"> <Check diff --git a/frontend/src/types/settings.d.ts b/frontend/src/types/settings.d.ts index 9ae6d8454..7b57f10cc 100644 --- a/frontend/src/types/settings.d.ts +++ b/frontend/src/types/settings.d.ts @@ -62,6 +62,7 @@ declare namespace Settings { postprocessing_cmd?: string; postprocessing_threshold: number; postprocessing_threshold_movie: number; + remove_profile_tags: string[]; single_language: boolean; subfolder: string; subfolder_custom?: string; |