Skip to content

Commit da76cbd

Browse files
committed
Updated to sonarr api v3 in order to work in sonarr 4.x
1 parent e01d14b commit da76cbd

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._root_folders = self.get_root_folders()
2828
self._all_series = {}
@@ -38,7 +38,7 @@ def lookup_series(self, title=None, tvdb_id=None):
3838
return [
3939
{
4040
"title": x.get("title"),
41-
"seasonCount": x.get("seasonCount", 0),
41+
"seasonCount": len(x.get("seasons")),
4242
"status": x.get("status", "Unknown Status"),
4343
"overview": x.get("overview", "Overview not available."),
4444
"network": x.get("network"),
@@ -141,7 +141,7 @@ def add_series(
141141
"tags": tag_ids,
142142
"addOptions": {
143143
"ignoreEpisodesWithFiles": unmonitor_existing,
144-
"ignoreEpisodesWithoutFiles": "false",
144+
"ignoreEpisodesWithoutFiles": False,
145145
"searchForMissingEpisodes": search,
146146
},
147147
}
@@ -227,7 +227,7 @@ def lookup_quality_profile(self, v):
227227
)
228228

229229
def get_all_quality_profiles(self):
230-
return self._api_get("profile", {}) or None
230+
return self._api_get("qualityprofile", {}) or None
231231

232232
def lookup_root_folder(self, v):
233233
# Look up root folder from a path or id

0 commit comments

Comments
 (0)