From 197340951c2fb9282a14bf56dfefd138d170476f Mon Sep 17 00:00:00 2001 From: Prinz23 Date: Thu, 21 Jun 2018 19:51:11 +0100 Subject: [PATCH] Fix API save show paused state and API exception raised when no indexer results. Fix API show pause not saved. Fix API exception when search doesn't find any results from a indexer (Web API). --- sickbeard/webapi.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sickbeard/webapi.py b/sickbeard/webapi.py index dc331166..1e4e9a3c 100644 --- a/sickbeard/webapi.py +++ b/sickbeard/webapi.py @@ -2414,14 +2414,12 @@ class CMD_SickGearSearchIndexers(ApiCall): lINDEXER_API_PARMS['custom_ui'] = classes.AllShowsNoFilterListUI t = sickbeard.indexerApi(i).indexer(**lINDEXER_API_PARMS) - apiData = None - try: apiData = t[str(self.name).encode(), False] except (StandardError, Exception): - pass + continue - for curSeries in apiData: + for curSeries in (apiData or []): s = {"indexerid": int(curSeries['id']), "name": curSeries['seriesname'], "first_aired": curSeries['firstaired'], @@ -3658,10 +3656,12 @@ class CMD_SickGearShowPause(ApiCall): return _responds(RESULT_FAILURE, msg="Show not found") if self.pause: - showObj.paused = 1 + showObj.paused = True + showObj.saveToDB() return _responds(RESULT_SUCCESS, msg=str(showObj.name) + " has been paused") else: - showObj.paused = 0 + showObj.paused = False + showObj.saveToDB() return _responds(RESULT_SUCCESS, msg=str(showObj.name) + " has been unpaused") return _responds(RESULT_FAILURE, msg=str(showObj.name) + " was unable to be paused")