From b745914d5884938a1f6da99cd718bfd2fb97849a Mon Sep 17 00:00:00 2001 From: P0psicles Date: Thu, 17 May 2018 08:45:34 +0200 Subject: [PATCH 1/2] Fix changing status from displayShow. --- medusa/server/web/home/handler.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/medusa/server/web/home/handler.py b/medusa/server/web/home/handler.py index d3de314157..8b2810d680 100644 --- a/medusa/server/web/home/handler.py +++ b/medusa/server/web/home/handler.py @@ -1915,7 +1915,11 @@ def setStatus(self, indexername=None, seriesid=None, eps=None, status=None, dire else: return self._genericMessage('Error', error_message) - # Use .has_key() since it is overridden for statusStrings in common.py + # statusStrings is a custom type. Which does some "magic" itself. But we want to move away from this. + # FIXME: Always chech status with status and quality with quality. + status_with_quality = status + status = Quality.split_composite_status(status).status + if status not in statusStrings: error_message = 'Invalid status' if direct: @@ -2007,7 +2011,7 @@ def setStatus(self, indexername=None, seriesid=None, eps=None, status=None, dire # We need current snatched quality to log 'quality' column in failed action in history if status != FAILED: # We're only setting the status (leaving the quality as is). - ep_obj.splitted_status_status = status + ep_obj.status = status_with_quality # mass add to database sql_l.append(ep_obj.get_sql()) From f88756890bad739ab09d43d5a05840fe0d33e28c Mon Sep 17 00:00:00 2001 From: Dario Date: Thu, 17 May 2018 09:41:04 +0200 Subject: [PATCH 2/2] Small changes --- medusa/server/web/home/handler.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/medusa/server/web/home/handler.py b/medusa/server/web/home/handler.py index 8b2810d680..d9873838b9 100644 --- a/medusa/server/web/home/handler.py +++ b/medusa/server/web/home/handler.py @@ -32,6 +32,7 @@ sab, ) from medusa.common import ( + ARCHIVED, DOWNLOADED, FAILED, IGNORED, @@ -1916,7 +1917,7 @@ def setStatus(self, indexername=None, seriesid=None, eps=None, status=None, dire return self._genericMessage('Error', error_message) # statusStrings is a custom type. Which does some "magic" itself. But we want to move away from this. - # FIXME: Always chech status with status and quality with quality. + # FIXME: Always check status with status and quality with quality. status_with_quality = status status = Quality.split_composite_status(status).status @@ -1981,7 +1982,7 @@ def setStatus(self, indexername=None, seriesid=None, eps=None, status=None, dire snatched_qualities = Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.SNATCHED_BEST - if status in Quality.DOWNLOADED and not ( + if status == DOWNLOADED and not ( ep_obj.status in snatched_qualities + Quality.DOWNLOADED and os.path.isfile(ep_obj.location)): logger.log('Refusing to change status of {series} {episode} to DOWNLOADED' @@ -2010,7 +2011,6 @@ def setStatus(self, indexername=None, seriesid=None, eps=None, status=None, dire # Only in failed_history we set to FAILED. # We need current snatched quality to log 'quality' column in failed action in history if status != FAILED: - # We're only setting the status (leaving the quality as is). ep_obj.status = status_with_quality # mass add to database @@ -2023,7 +2023,7 @@ def setStatus(self, indexername=None, seriesid=None, eps=None, status=None, dire if app.USE_TRAKT and app.TRAKT_SYNC_WATCHLIST: if status in [WANTED, FAILED]: upd = 'Add' - elif status in [IGNORED, SKIPPED] + Quality.DOWNLOADED + Quality.ARCHIVED: + elif status in [IGNORED, SKIPPED, DOWNLOADED, ARCHIVED]: upd = 'Remove' logger.log('{action} episodes, showid: indexerid {show.indexerid}, Title {show.name} to Watchlist'.format(