Merge pull request #192 from JackDandy/feature/AddPercentageToFooter

Add percentage of episodes downloaded to footer and remove double spaces...
This commit is contained in:
JackDandy 2015-02-14 16:32:02 +00:00
commit 6d66e21777
2 changed files with 27 additions and 26 deletions

View file

@ -47,6 +47,7 @@
* Change the ui notifications to show the Plex Media Server(s) actioned for library updating
* Fix issue where PMS text wasn't initialised on the config/notifications page and added info about Plex clients
* Add ability to test Plex Server(s) on config/notifications page
* Add percentage of episodes downloaded to footer and remove double spaces in text
[develop changelog]
* Change uT params from unicode to str.format as magnet URLs worked but sending files in POST bodies failed

View file

@ -10,24 +10,23 @@
<div class="footer clearfix">
#set $my_db = $db.DBConnection()
#set $today = str($datetime.date.today().toordinal())
#set status_quality = '(' + ','.join([str(quality) for quality in $Quality.SNATCHED + $Quality.SNATCHED_PROPER]) + ')'
#set status_download = '(' + ','.join([str(quality) for quality in $Quality.DOWNLOADED + [$ARCHIVED]]) + ')'
#set $sql_statement = 'SELECT '
#set $sql_statement += '(SELECT COUNT(*) FROM tv_episodes WHERE season > 0 AND episode > 0 AND airdate > 1 AND status IN ' + $status_quality + ') AS ep_snatched, '
#set $sql_statement += '(SELECT COUNT(*) FROM tv_episodes WHERE season > 0 AND episode > 0 AND airdate > 1 AND status IN ' + $status_download + ') AS ep_downloaded, '
#set $sql_statement += '(SELECT COUNT(*) FROM tv_episodes WHERE season > 0 AND episode > 0 AND airdate > 1 '
#set $sql_statement += ' AND ((airdate <= ' + $today + ' AND (status = ' + str($SKIPPED) + ' OR status = ' + str($WANTED) + ')) '
#set $sql_statement += ' OR (status IN ' + status_quality + ') OR (status IN ' + status_download + '))) AS ep_total '
#set $sql_statement += ' FROM tv_episodes tv_eps LIMIT 1'
#set status_quality = '(%s)' % ','.join([str(quality) for quality in $Quality.SNATCHED + $Quality.SNATCHED_PROPER])
#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, '\
% $status_quality\
+ '(SELECT COUNT(*) FROM tv_episodes WHERE season > 0 AND episode > 0 AND airdate > 1 AND status IN %s) AS ep_downloaded, '\
% $status_download\
+ '(SELECT COUNT(*) FROM tv_episodes WHERE season > 0 AND episode > 0 AND airdate > 1 '\
+ ' AND ((airdate <= %s AND (status = %s OR status = %s)) '\
% ($today, str($SKIPPED), str($WANTED))\
+ ' OR (status IN %s) OR (status IN %s))) AS ep_total FROM tv_episodes tv_eps LIMIT 1'\
% ($status_quality, $status_download)
#set $sql_result = $my_db.select($sql_statement)
#set $shows_total = len($sickbeard.showList)
#set $shows_active = len([show for show in $sickbeard.showList if show.paused == 0 and show.status != "Ended"])
#set $shows_active = len([show for show in $sickbeard.showList if 0 == show.paused and 'Ended' != show.status])
#if $sql_result:
#set $ep_snatched = $sql_result[0]['ep_snatched']
@ -38,6 +37,8 @@
#set $ep_downloaded = 0
#set $ep_total = 0
#end if
#set $ep_percentage = '' if $ep_total == 0 else '(<span class="footerhighlight">{:.1%}</span>)'.format(float($ep_downloaded)/float($ep_total))
#try
#set $localRoot = $sbRoot
#except NotFound
@ -50,18 +51,17 @@
#end try
<span class="footerhighlight">$shows_total</span> shows (<span class="footerhighlight">$shows_active</span> active)
| <span class="footerhighlight"><%= ep_downloaded %></span>
<%= (
'',\
' (<span class="footerhighlight">+%s</span> snatched)' % \
(
str(ep_snatched),
'<a href="%s/manage/episodeStatuses?whichStatus=2" title="View overview of snatched episodes">%s</a>' % \
(localRoot, str(ep_snatched))
)['Episode Overview' != localheader]
)[0 < ep_snatched]
%>
&nbsp;/&nbsp;<span class="footerhighlight">$ep_total</span> episodes downloaded
| <span class="footerhighlight">$ep_downloaded</span><%=
(
'',
' (<span class="footerhighlight">+%s</span> snatched)'\
% (
str(ep_snatched),
'<a href="%s/manage/episodeStatuses?whichStatus=2" title="View overview of snatched episodes">%s</a>'\
% (localRoot, str(ep_snatched))
)['Episode Overview' != localheader]
)[0 < ep_snatched]
%>&nbsp;/&nbsp;<span class="footerhighlight">$ep_total</span> episodes downloaded $ep_percentage
| recent search: <span class="footerhighlight"><%= str(sickbeard.recentSearchScheduler.timeLeft()).split('.')[0] %></span>
| backlog search: <span class="footerhighlight"><%= str(sickbeard.backlogSearchScheduler.timeLeft()).split('.')[0] %></span>