Skip to content

Commit 7a9bd99

Browse files
authored
Merge pull request #64 from vinimk/sonarr-v3-api
Updated to sonarr api v3 in order to work in sonarr 4.x
2 parents b7495e8 + da76cbd commit 7a9bd99

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sonarr.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self, api_url, api_key, verbose=False):
2222
self.logger.error(
2323
"Invalid Sonarr URL detected. Please update your settings to include http:// or https:// on the beginning of the URL."
2424
)
25-
self.api_url = api_url + "/api/{endpoint}?apikey=" + api_key
25+
self.api_url = api_url + "/api/v3/{endpoint}?apikey=" + api_key
2626
self._quality_profiles = self.get_all_quality_profiles()
2727
self._language_profiles = self.get_all_language_profiles()
2828
self._root_folders = self.get_root_folders()
@@ -39,7 +39,7 @@ def lookup_series(self, title=None, tvdb_id=None):
3939
return [
4040
{
4141
"title": x.get("title"),
42-
"seasonCount": x.get("seasonCount", 0),
42+
"seasonCount": len(x.get("seasons")),
4343
"status": x.get("status", "Unknown Status"),
4444
"overview": x.get("overview", "Overview not available."),
4545
"network": x.get("network"),
@@ -144,7 +144,7 @@ def add_series(
144144
"tags": tag_ids,
145145
"addOptions": {
146146
"ignoreEpisodesWithFiles": unmonitor_existing,
147-
"ignoreEpisodesWithoutFiles": "false",
147+
"ignoreEpisodesWithoutFiles": False,
148148
"searchForMissingEpisodes": search,
149149
},
150150
}
@@ -243,7 +243,7 @@ def lookup_language_profile(self, v):
243243
)
244244

245245
def get_all_quality_profiles(self):
246-
return self._api_get("profile", {}) or None
246+
return self._api_get("qualityprofile", {}) or None
247247

248248
def get_all_language_profiles(self):
249249
return self._api_get("v3/languageprofile", {}) or None

0 commit comments

Comments
 (0)