From d25c353cdb5f73cb09c981486bfda5d3094d9aec Mon Sep 17 00:00:00 2001 From: owine Date: Wed, 29 Jun 2022 10:50:46 -0500 Subject: [PATCH] Sonarr: Update to use v3 API only --- media/sonarr.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/media/sonarr.py b/media/sonarr.py index c5ff4cc..b9718ef 100644 --- a/media/sonarr.py +++ b/media/sonarr.py @@ -13,7 +13,7 @@ log = logger.get_logger(__name__) class Sonarr(PVR): def get_objects(self): - return self._get_objects('api/series') + return self._get_objects('api/v3/series') @backoff.on_predicate(backoff.expo, lambda x: x is None, max_tries=4, on_backoff=backoff_handler) def get_tags(self): @@ -21,7 +21,7 @@ class Sonarr(PVR): try: # make request req = requests.get( - os.path.join(misc_str.ensure_endswith(self.server_url, "/"), 'api/tag'), + os.path.join(misc_str.ensure_endswith(self.server_url, "/"), 'api/v3/tag'), headers=self.headers, timeout=60, allow_redirects=False @@ -52,15 +52,12 @@ class Sonarr(PVR): 'seasons': [], 'seasonFolder': season_folder, 'seriesType': series_type, + 'languageProfileId': language_profile_id, 'addOptions': { 'searchForMissingEpisodes': search_missing } }) - if language_profile_id: - payload['languageProfileId'] = language_profile_id - endpoint = 'api/v3/series' - else: - endpoint = 'api/series' + endpoint = 'api/v3/series' return self._add_object(endpoint, payload, identifier_field='tvdbId', identifier=series_tvdb_id)