From ce544e1b80fded265557bc75dc30d5390fdc745e Mon Sep 17 00:00:00 2001 From: Prinz23 Date: Mon, 20 Sep 2021 22:46:20 +0200 Subject: [PATCH] Fix filter in history API endpoint. --- CHANGES.md | 7 ++++++- sickbeard/webapi.py | 11 +++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e1d4f09..2610843 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,9 @@ -### 0.25.2 (2021-09-20 20:00:00 UTC) +### 0.25.3 (2021-09-21 22:00:00 UTC) + +* Fix filter in history API endpoint + + +### 0.25.2 (2021-09-20 20:00:00 UTC) * Fix history API endpoint for all snatch and download statuses (including archived, failed) diff --git a/sickbeard/webapi.py b/sickbeard/webapi.py index a809b83..9211bb7 100644 --- a/sickbeard/webapi.py +++ b/sickbeard/webapi.py @@ -46,8 +46,8 @@ from lib import subliminal import sickbeard from . import classes, db, helpers, history, image_cache, logger, network_timezones, processTV, search_queue, ui -from .common import ARCHIVED, DOWNLOADED, IGNORED, SKIPPED, SNATCHED, SNATCHED_ANY, SNATCHED_BEST, SNATCHED_PROPER, \ - UNAIRED, UNKNOWN, WANTED, Quality, qualityPresetStrings, statusStrings +from .common import ARCHIVED, DOWNLOADED, FAILED, IGNORED, SKIPPED, SNATCHED, SNATCHED_ANY, SNATCHED_BEST, \ + SNATCHED_PROPER, UNAIRED, UNKNOWN, WANTED, Quality, qualityPresetStrings, statusStrings from .helpers import remove_article from .indexers import indexer_api, indexer_config from .indexers.indexer_config import * @@ -1618,10 +1618,13 @@ class CMD_SickGearHistory(ApiCall): """ get the sickgear downloaded/snatched history """ # typeCodes = [] + type_filter = [] if "downloaded" == self.type: + type_filter = [DOWNLOADED, ARCHIVED, FAILED] self.type = "Downloaded" typeCodes = Quality.DOWNLOADED + Quality.ARCHIVED + Quality.FAILED elif "snatched" == self.type: + type_filter = SNATCHED_ANY self.type = "Snatched" typeCodes = Quality.SNATCHED_ANY else: @@ -1649,9 +1652,9 @@ class CMD_SickGearHistory(ApiCall): results = [] for cur_result in sql_result: status, quality = Quality.splitCompositeStatus(int(cur_result["action"])) - status = _get_status_Strings(status) - if self.type and not status == self.type: + if type_filter and status not in type_filter: continue + status = _get_status_Strings(status) cur_result["status"] = status cur_result["quality"] = _get_quality_string(quality) cur_result["date"] = _historyDate_to_dateTimeForm(str(cur_result["date"]))