Merge pull request #1009 from JackDandy/feature/AddSnatchedBest

Add status SNATCHED_BEST to missing places.
This commit is contained in:
JackDandy 2017-10-31 20:54:02 +00:00 committed by GitHub
commit 2c66097598
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 14 deletions

View file

@ -13,7 +13,7 @@
<div class="footer clearfix">
#set $my_db = $db.DBConnection()
#set $today = str($datetime.date.today().toordinal())
#set status_quality = '(%s)' % ','.join([str(quality) for quality in $Quality.SNATCHED + $Quality.SNATCHED_PROPER])
#set status_quality = '(%s)' % ','.join([str(quality) for quality in $Quality.SNATCHED + $Quality.SNATCHED_PROPER + $Quality.SNATCHED_BEST])
#set status_download = '(%s)' % ','.join([str(quality) for quality in $Quality.DOWNLOADED + [$ARCHIVED]])
#set $sql_statement = 'SELECT '\
+ '(SELECT COUNT(*) FROM tv_episodes WHERE season > 0 AND episode > 0 AND airdate > 1 AND status IN %s) AS ep_snatched, '\

View file

@ -49,7 +49,7 @@
$statusList.remove($int($whichStatus))
#end if
#if $int($whichStatus) in [$common.SNATCHED, $common.SNATCHED_PROPER]
#if $int($whichStatus) in [$common.SNATCHED, $common.SNATCHED_PROPER, $common.SNATCHED_BEST]
$statusList.append($common.FAILED)
#end if

View file

@ -845,7 +845,7 @@ class TVShow(object):
% (Quality.qualityStrings[old_quality], Quality.qualityStrings[new_quality]), logger.DEBUG)
new_status = DOWNLOADED
elif old_status not in (SNATCHED, SNATCHED_PROPER):
elif old_status not in (SNATCHED, SNATCHED_PROPER, SNATCHED_BEST):
new_status = DOWNLOADED
if None is not new_status:
@ -2011,7 +2011,7 @@ class TVEpisode(object):
# if we have a media file then it's downloaded
elif sickbeard.helpers.has_media_ext(self.location):
# leave propers alone, you have to either post-process them or manually change them back
if self.status not in Quality.SNATCHED_PROPER + Quality.DOWNLOADED + Quality.SNATCHED + [ARCHIVED]:
if self.status not in Quality.SNATCHED_PROPER + Quality.SNATCHED_BEST + Quality.DOWNLOADED + Quality.SNATCHED + [ARCHIVED]:
msg = '(1) Status changes from %s to ' % statusStrings[self.status]
self.status = Quality.statusFromNameOrFile(self.location, anime=self.show.is_anime)
logger.log('%s%s' % (msg, statusStrings[self.status]), logger.DEBUG)

View file

@ -36,7 +36,7 @@ from sickbeard import classes
from sickbeard import processTV
from sickbeard import network_timezones, sbdatetime
from sickbeard.exceptions import ex
from sickbeard.common import SNATCHED, SNATCHED_PROPER, DOWNLOADED, SKIPPED, UNAIRED, IGNORED, ARCHIVED, WANTED, UNKNOWN
from sickbeard.common import SNATCHED, SNATCHED_PROPER, SNATCHED_BEST, DOWNLOADED, SKIPPED, UNAIRED, IGNORED, ARCHIVED, WANTED, UNKNOWN
from sickbeard.helpers import remove_article
from common import Quality, qualityPresetStrings, statusStrings
from sickbeard.indexers.indexer_config import *
@ -2469,7 +2469,7 @@ class CMD_ShowStats(ApiCall):
episode_status_counts_total = {}
episode_status_counts_total["total"] = 0
for status in statusStrings.statusStrings.keys():
if status in [UNKNOWN, DOWNLOADED, SNATCHED, SNATCHED_PROPER]:
if status in [UNKNOWN, DOWNLOADED, SNATCHED, SNATCHED_PROPER, SNATCHED_BEST]:
continue
episode_status_counts_total[status] = 0
@ -2485,7 +2485,7 @@ class CMD_ShowStats(ApiCall):
# add all snatched qualities
episode_qualities_counts_snatch = {}
episode_qualities_counts_snatch["total"] = 0
for statusCode in Quality.SNATCHED + Quality.SNATCHED_PROPER:
for statusCode in Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.SNATCHED_BEST:
status, quality = Quality.splitCompositeStatus(statusCode)
if quality in [Quality.NONE]:
continue
@ -2503,7 +2503,7 @@ class CMD_ShowStats(ApiCall):
if status in Quality.DOWNLOADED:
episode_qualities_counts_download["total"] += 1
episode_qualities_counts_download[int(row["status"])] += 1
elif status in Quality.SNATCHED + Quality.SNATCHED_PROPER:
elif status in Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.SNATCHED_BEST:
episode_qualities_counts_snatch["total"] += 1
episode_qualities_counts_snatch[int(row["status"])] += 1
elif status == 0: # we dont count NONE = 0 = N/A
@ -2659,7 +2659,7 @@ class CMD_ShowsStats(ApiCall):
0]
stats["ep_total"] = myDB.select(
"SELECT COUNT(*) FROM tv_episodes WHERE season != 0 AND episode != 0 AND (airdate != 1 OR status IN (" + ",".join(
[str(show) for show in (Quality.DOWNLOADED + Quality.SNATCHED + Quality.SNATCHED_PROPER) + [
[str(show) for show in (Quality.DOWNLOADED + Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.SNATCHED_BEST) + [
ARCHIVED]]) + ")) AND airdate <= " + today + " AND status != " + str(IGNORED) + "")[0][0]
return _responds(RESULT_SUCCESS, stats)

View file

@ -727,7 +727,7 @@ class Home(MainHandler):
# Get all show snatched / downloaded / next air date stats
myDB = db.DBConnection()
today = datetime.date.today().toordinal()
status_quality = ','.join([str(x) for x in Quality.SNATCHED + Quality.SNATCHED_PROPER])
status_quality = ','.join([str(x) for x in Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.SNATCHED_BEST])
status_download = ','.join([str(x) for x in Quality.DOWNLOADED + [ARCHIVED]])
status_total = '%s, %s, %s' % (SKIPPED, WANTED, FAILED)
@ -3814,7 +3814,7 @@ class Manage(MainHandler):
def showEpisodeStatuses(self, indexer_id, whichStatus):
status_list = [int(whichStatus)]
if status_list[0] == SNATCHED:
status_list = Quality.SNATCHED + Quality.SNATCHED_PROPER
status_list = Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.SNATCHED_BEST
myDB = db.DBConnection()
cur_show_results = myDB.select(
@ -3841,7 +3841,7 @@ class Manage(MainHandler):
whichStatus = int(whichStatus)
status_list = [whichStatus]
if status_list[0] == SNATCHED:
status_list = Quality.SNATCHED + Quality.SNATCHED_PROPER
status_list = Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.SNATCHED_BEST
else:
status_list = []
@ -3852,7 +3852,7 @@ class Manage(MainHandler):
my_db = db.DBConnection()
sql_result = my_db.select(
'SELECT COUNT(*) AS snatched FROM [tv_episodes] WHERE season > 0 AND episode > 0 AND airdate > 1 AND ' +
'status IN (%s)' % ','.join([str(quality) for quality in Quality.SNATCHED + Quality.SNATCHED_PROPER]))
'status IN (%s)' % ','.join([str(quality) for quality in Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.SNATCHED_BEST]))
t.default_manage = sql_result and sql_result[0]['snatched'] and SNATCHED or WANTED
# if we have no status then this is as far as we need to go
@ -3898,7 +3898,7 @@ class Manage(MainHandler):
def changeEpisodeStatuses(self, oldStatus, newStatus, wantedStatus=sickbeard.common.UNKNOWN, *args, **kwargs):
status_list = [int(oldStatus)]
if status_list[0] == SNATCHED:
status_list = Quality.SNATCHED + Quality.SNATCHED_PROPER
status_list = Quality.SNATCHED + Quality.SNATCHED_PROPER + Quality.SNATCHED_BEST
to_change = {}