diff --git a/medusa/server/web/home/handler.py b/medusa/server/web/home/handler.py index d3de314157..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, @@ -1915,7 +1916,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 check 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: @@ -1977,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' @@ -2006,8 +2011,7 @@ 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.splitted_status_status = status + ep_obj.status = status_with_quality # mass add to database sql_l.append(ep_obj.get_sql()) @@ -2019,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(