Skip to content

Commit

Permalink
fix error when there were no movies/series to add
Browse files Browse the repository at this point in the history
  • Loading branch information
meisnate12 committed Oct 7, 2021
1 parent 9758a96 commit 336bb5e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.6
1.1.7
2 changes: 1 addition & 1 deletion arrapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class BaseAPI(ABC):

@abstractmethod
def __init__(self, url, apikey, v1=False, session=None):
self.url = url
self.url = url.rstrip("/")
self.apikey = apikey
self.session = Session() if session is None else session
self.v1 = v1
Expand Down
9 changes: 5 additions & 4 deletions arrapi/radarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,11 @@ def add_multiple_movies(self, ids: List[Union[int, str, Movie]],
existing_movies.append(movie)
except NotFound:
not_found_ids.append(item)
if per_request is None:
per_request = len(json)
for i in range(0, len(json), per_request):
movies.extend([Movie(self, data=m) for m in self._post_movie_import(json[i:i+per_request])])
if len(json) > 0:
if per_request is None:
per_request = len(json)
for i in range(0, len(json), per_request):
movies.extend([Movie(self, data=m) for m in self._post_movie_import(json[i:i+per_request])])
return movies, existing_movies, not_found_ids

def edit_multiple_movies(self, ids: List[Union[int, str, Movie]],
Expand Down
9 changes: 5 additions & 4 deletions arrapi/sonarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,11 @@ def add_multiple_series(self, tvdb_ids: List[Union[Series, int]],
existing_series.append(show)
except NotFound:
not_found_ids.append(tvdb_id)
if per_request is None:
per_request = len(json)
for i in range(0, len(json), per_request):
series.extend([Series(self, data=s) for s in self._post_series_import(json[i:i+per_request])])
if len(json) > 0:
if per_request is None:
per_request = len(json)
for i in range(0, len(json), per_request):
series.extend([Series(self, data=s) for s in self._post_series_import(json[i:i+per_request])])
return series, existing_series, not_found_ids

def edit_multiple_series(self, tvdb_ids: List[Union[Series, int]],
Expand Down

0 comments on commit 336bb5e

Please sign in to comment.