Commit 0cdda844 authored by echel0n's avatar echel0n
Browse files

legacy API v1 endpoint show.seasons now returns "Season not found" if season...

legacy API v1 endpoint show.seasons now returns "Season not found" if season param is passed only and season does not exist in database
parent 1cec8208
...@@ -2361,9 +2361,6 @@ class CMD_ShowSeasonList(ApiV1Handler): ...@@ -2361,9 +2361,6 @@ class CMD_ShowSeasonList(ApiV1Handler):
if not show_obj: if not show_obj:
return _responds(RESULT_FAILURE, msg="Show not found") return _responds(RESULT_FAILURE, msg="Show not found")
while show_obj.is_loading_episodes:
time.sleep(1)
season_list = set() season_list = set()
for episode_object in show_obj.episodes: for episode_object in show_obj.episodes:
season_list.add(episode_object.season) season_list.add(episode_object.season)
...@@ -2403,13 +2400,12 @@ class CMD_ShowSeasons(ApiV1Handler): ...@@ -2403,13 +2400,12 @@ class CMD_ShowSeasons(ApiV1Handler):
if not show_obj: if not show_obj:
return _responds(RESULT_FAILURE, msg="Show not found") return _responds(RESULT_FAILURE, msg="Show not found")
while show_obj.is_loading_episodes:
time.sleep(1)
if self.season is None: if self.season is None:
db_data = session.query(MainDB.TVEpisode).filter_by(series_id=self.series_id, series_provider_id=show_obj.series_provider_id) db_data = session.query(MainDB.TVEpisode).filter_by(series_id=self.series_id, series_provider_id=show_obj.series_provider_id)
else: else:
db_data = session.query(MainDB.TVEpisode).filter_by(series_id=self.series_id, series_provider_id=show_obj.series_provider_id, season=self.season) db_data = session.query(MainDB.TVEpisode).filter_by(series_id=self.series_id, series_provider_id=show_obj.series_provider_id, season=self.season)
if not db_data.all():
return _responds(RESULT_FAILURE, msg="Season not found")
for row in db_data: for row in db_data:
episode_dict = row.as_dict() episode_dict = row.as_dict()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment