Merge pull request #261 from JackDandy/feature/ChangeBacklogOverview

Change "Force Backlog" button for paused shows on Backlog Overview page ...
This commit is contained in:
JackDandy 2015-03-10 23:42:48 +00:00
commit 1f8f396506
4 changed files with 53 additions and 39 deletions

View file

@ -20,6 +20,7 @@
* Add Unknown status query to Episode Status Management
* Fix Episode Status Management error popup from coming up when show is selected without expanding
* Add BET network logo
* Change "Force Backlog" button for paused shows on Backlog Overview page to "Paused" indicator
* Remove unused force variable from code and PEP8
* Change browser, bs4 parser and classes code to PEP8 standards
* Change common and config code to PEP8 standards

View file

@ -7,7 +7,7 @@
#set global $sbPath = '..'
#set global $topmenu = 'manage'#
#set global $topmenu = 'manage'
#import os.path
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_top.tmpl')
@ -29,7 +29,7 @@
dateHasTime : false,
dateFormat : '${sickbeard.DATE_PRESET}',
timeFormat : '${sickbeard.TIME_PRESET}',
trimZero : #if $sickbeard.TRIM_ZERO then "true" else "false"#
trimZero : #if $sickbeard.TRIM_ZERO then 'true' else 'false'#
});
#end if
@ -44,70 +44,77 @@
#else
<h1 class="title">$title</h1>
#end if
#set $totalWanted = 0
#set $totalQual = 0
#for $curShow in $sickbeard.showList:
#set $totalWanted = $totalWanted + $showCounts[$curShow.indexerid][$Overview.WANTED]
#set $totalQual = $totalQual + $showCounts[$curShow.indexerid][$Overview.QUAL]
#set $totalWanted += $showCounts[$curShow.indexerid][$Overview.WANTED]
#set $totalQual += $showCounts[$curShow.indexerid][$Overview.QUAL]
#end for
<div class="h2footer pull-right">
<span class="listing-key wanted">Wanted: <b>$totalWanted</b></span>
<span class="listing-key qual">Low Quality: <b>$totalQual</b></span>
</div><br/>
</div>
<br/>
<div class="pull-left">
Jump to Show
<select id="pickShow" class="form-control form-control-inline input-sm">
#for $curShow in sorted($sickbeard.showList, key = operator.attrgetter('name')):
#if $showCounts[$curShow.indexerid][$Overview.QUAL] + $showCounts[$curShow.indexerid][$Overview.WANTED] != 0:
<option value="$curShow.indexerid">$curShow.name</option>
#end if
#end for
</select>
#for $curShow in sorted($sickbeard.showList, key = operator.attrgetter('name')):
#if 0 != $showCounts[$curShow.indexerid][$Overview.QUAL] + $showCounts[$curShow.indexerid][$Overview.WANTED]:
<option value="$curShow.indexerid">$curShow.name</option>
#end if
#end for
</select>
</div>
<table class="sickbeardTable" cellspacing="0" border="0" cellpadding="0">
#for $curShow in sorted($sickbeard.showList, key = operator.attrgetter('name')):
#if $showCounts[$curShow.indexerid][$Overview.QUAL] + $showCounts[$curShow.indexerid][$Overview.WANTED] == 0:
#continue
#end if
#if 0 == $showCounts[$curShow.indexerid][$Overview.QUAL] + $showCounts[$curShow.indexerid][$Overview.WANTED]:
#continue
#end if
<tr class="seasonheader" id="show-$curShow.indexerid">
<td colspan="3" class="align-left">
<br/><h2><a href="$sbRoot/home/displayShow?show=$curShow.indexerid">$curShow.name</a></h2>
<br/>
<h2><a href="$sbRoot/home/displayShow?show=$curShow.indexerid">$curShow.name</a></h2>
<div class="pull-right">
<span class="listing-key wanted">Wanted: <b>$showCounts[$curShow.indexerid][$Overview.WANTED]</b></span>
<span class="listing-key qual">Low Quality: <b>$showCounts[$curShow.indexerid][$Overview.QUAL]</b></span>
#if not $curShow.paused:
<a class="btn btn-inline forceBacklog" href="$sbRoot/manage/backlogShow?indexer_id=$curShow.indexerid"><i class="icon-play-circle icon-white"></i> Force Backlog</a>
#else
<span class="quality SD btn-inline forceBacklog" style="padding:4px 10px; margin-bottom:1px">Paused</span>
#end if
</div>
</td>
</tr>
<tr class="seasoncols"><th>Episode</th><th>Name</th><th class="nowrap">Airdate</th></tr>
#for $curResult in $showSQLResults[$curShow.indexerid]:
#set $whichStr = $str($curResult['season']) + 'x' + $str($curResult['episode'])
#try:
#set $overview = $showCats[$curShow.indexerid][$whichStr]
#except Exception
#continue
#end try
#for $curResult in $showSQLResults[$curShow.indexerid]:
#set $whichStr = $str($curResult['season']) + 'x' + $str($curResult['episode'])
#try:
#set $overview = $showCats[$curShow.indexerid][$whichStr]
#except Exception
#continue
#end try
#if $overview not in ($Overview.QUAL, $Overview.WANTED):
#continue
#end if
#if $overview not in ($Overview.QUAL, $Overview.WANTED):
#continue
#end if
<tr class="seasonstyle $Overview.overviewStrings[$showCats[$curShow.indexerid][$whichStr]]">
<td class="tableleft" align="center">$whichStr</td>
<td>$curResult["name"]</td>
<td class="tableright" align="center" class="nowrap"><div class="${fuzzydate}">#if int($curResult['airdate']) == 1 then 'never' else $sbdatetime.sbdatetime.sbfdate($sbdatetime.sbdatetime.convert_to_setting($network_timezones.parse_date_time($curResult['airdate'],$curShow.airs,$curShow.network)))#</div></td>
</tr>
#end for
#end for
#end for
</table>

View file

@ -1025,7 +1025,7 @@ def _check_against_names(nameInQuestion, show, season=-1):
def get_show(name, tryIndexers=False):
if not sickbeard.showList:
if not sickbeard.showList or None is name:
return
showObj = None

View file

@ -1533,24 +1533,30 @@ class Home(MainHandler):
myDB = db.DBConnection()
myDB.mass_action(sql_l)
if int(status) == WANTED:
msg = 'Backlog was automatically started for the following seasons of <b>' + showObj.name + '</b>:<br />'
msg += '<ul>'
if WANTED == int(status):
season_list = ''
season_wanted = []
for season, segment in segments.items():
cur_backlog_queue_item = search_queue.BacklogQueueItem(showObj, segment)
sickbeard.searchQueueScheduler.action.add_item(cur_backlog_queue_item) # @UndefinedVariable
if not showObj.paused:
cur_backlog_queue_item = search_queue.BacklogQueueItem(showObj, segment)
sickbeard.searchQueueScheduler.action.add_item(cur_backlog_queue_item) # @UndefinedVariable
msg += '<li>Season ' + str(season) + '</li>'
logger.log(u'Sending backlog for ' + showObj.name + ' season ' + str(
season) + ' because some eps were set to wanted')
if season not in season_wanted:
season_wanted += [season]
season_list += u'<li>Season %s</li>' % season
logger.log((u'Not adding wanted eps to backlog search for %s season %s because show is paused',
u'Starting backlog search for %s season %s because eps were set to wanted')[
not showObj.paused] % (showObj.name, season))
msg += '</ul>'
(title, msg) = (('Not starting backlog', u'Paused show prevented backlog search'),
('Backlog started', u'Backlog search started'))[not showObj.paused]
if segments:
ui.notifications.message('Backlog started', msg)
ui.notifications.message(title,
u'%s for the following seasons of <b>%s</b>:<br /><ul>%s</ul>'
% (msg, showObj.name, season_list))
if int(status) == FAILED:
elif FAILED == int(status):
msg = 'Retrying Search was automatically started for the following season of <b>' + showObj.name + '</b>:<br />'
msg += '<ul>'