From ecfc3c378ee6bc97c87846aeaf2ec181d9005966 Mon Sep 17 00:00:00 2001 From: Joris Date: Fri, 2 Apr 2021 11:33:19 +0200 Subject: [PATCH] feat: add language_profile_id option for sonarr --- modules/config.py | 2 ++ modules/sonarr.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/config.py b/modules/config.py index 5c26dfd0..aac91544 100644 --- a/modules/config.py +++ b/modules/config.py @@ -258,6 +258,7 @@ class Config: self.general["sonarr"]["version"] = check_for_attribute(self.data, "version", parent="sonarr", test_list=["v2", "v3"], options=" v2 (For Sonarr 0.2)\n v3 (For Sonarr 3.0)", default="v2") self.general["sonarr"]["quality_profile"] = check_for_attribute(self.data, "quality_profile", parent="sonarr", default_is_none=True) self.general["sonarr"]["root_folder_path"] = check_for_attribute(self.data, "root_folder_path", parent="sonarr", default_is_none=True) + self.general["sonarr"]["language_profile_id"] = check_for_attribute(self.data, "language_profile_id", parent="sonarr", default=1) self.general["sonarr"]["add"] = check_for_attribute(self.data, "add", parent="sonarr", var_type="bool", default=False) self.general["sonarr"]["search"] = check_for_attribute(self.data, "search", parent="sonarr", var_type="bool", default=False) self.general["sonarr"]["season_folder"] = check_for_attribute(self.data, "season_folder", parent="sonarr", var_type="bool", default=True) @@ -358,6 +359,7 @@ class Config: sonarr_params["version"] = check_for_attribute(lib, "version", parent="sonarr", test_list=["v2", "v3"], options=" v2 (For Sonarr 0.2)\n v3 (For Sonarr 3.0)", default=self.general["sonarr"]["version"], save=False) sonarr_params["quality_profile"] = check_for_attribute(lib, "quality_profile", parent="sonarr", default=self.general["sonarr"]["quality_profile"], req_default=True, save=False) sonarr_params["root_folder_path"] = check_for_attribute(lib, "root_folder_path", parent="sonarr", default=self.general["sonarr"]["root_folder_path"], req_default=True, save=False) + sonarr_params["language_profile_id"] = check_for_attribute(lib, "language_profile_id", parent="sonarr", default=self.general["sonarr"]["language_profile_id"], save=False) sonarr_params["add"] = check_for_attribute(lib, "add", parent="sonarr", var_type="bool", default=self.general["sonarr"]["add"], save=False) sonarr_params["search"] = check_for_attribute(lib, "search", parent="sonarr", var_type="bool", default=self.general["sonarr"]["search"], save=False) sonarr_params["season_folder"] = check_for_attribute(lib, "season_folder", parent="sonarr", var_type="bool", default=self.general["sonarr"]["season_folder"], save=False) diff --git a/modules/sonarr.py b/modules/sonarr.py index 4ae3268b..91617d65 100644 --- a/modules/sonarr.py +++ b/modules/sonarr.py @@ -34,6 +34,7 @@ class SonarrAPI: self.version = params["version"] self.token = params["token"] self.root_folder_path = params["root_folder_path"] + self.language_profile_id = params["language_profile_id"] self.add = params["add"] self.search = params["search"] self.season_folder = params["season_folder"] @@ -67,7 +68,7 @@ class SonarrAPI: url_json = { "title": show.title, f"{'qualityProfileId' if self.version == 'v3' else 'profileId'}": self.quality_profile_id, - "languageProfileId": 1, + "languageProfileId": self.language_profile_id, "tvdbId": int(tvdb_id), "titleslug": titleslug, "language": self.language,