mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-13 21:05:11 -05:00
272 lines
9.3 KiB
Cheetah
272 lines
9.3 KiB
Cheetah
#import sickbeard
|
|
#import datetime
|
|
#from sickbeard.common import *
|
|
#from sickbeard import db, sbdatetime, network_timezones
|
|
|
|
#set global $title="Home"
|
|
#set global $header="Show List"
|
|
|
|
#set global $sbPath = ".."
|
|
|
|
#set global $topmenu="home"#
|
|
#import os.path
|
|
#include $os.path.join($sickbeard.PROG_DIR, "gui/slick/interfaces/default/inc_top.tmpl")
|
|
|
|
#set $myDB = $db.DBConnection()
|
|
#set $today = str($datetime.date.today().toordinal())
|
|
#set $downloadedEps = $myDB.select("SELECT showid, COUNT(*) FROM tv_episodes WHERE (status IN ("+",".join([str(x) for x in $Quality.DOWNLOADED + [$ARCHIVED]])+") OR (status IN ("+",".join([str(x) for x in $Quality.SNATCHED + $Quality.SNATCHED_PROPER])+") AND location != '')) AND season != 0 and episode != 0 AND airdate <= "+$today+" GROUP BY showid")
|
|
#set $allEps = $myDB.select("SELECT showid, COUNT(*) FROM tv_episodes WHERE season != 0 and episode != 0 AND (airdate != 1 OR status IN ("+",".join([str(x) for x in ($Quality.DOWNLOADED + $Quality.SNATCHED + $Quality.SNATCHED_PROPER) + [$ARCHIVED]])+")) AND airdate <= "+$today+" AND status != "+str($IGNORED)+" GROUP BY showid")
|
|
#set $layout = $sickbeard.HOME_LAYOUT
|
|
|
|
<style type="text/css">
|
|
.sort_data {display:none}
|
|
</style>
|
|
|
|
<script type="text/javascript" charset="utf-8">
|
|
<!--
|
|
|
|
\$.tablesorter.addParser({
|
|
id: 'loadingNames',
|
|
is: function(s) {
|
|
return false;
|
|
},
|
|
format: function(s) {
|
|
if (s.indexOf('Loading...') == 0)
|
|
return s.replace('Loading...','000');
|
|
else
|
|
#if not $sickbeard.SORT_ARTICLE:
|
|
return (s || '').replace(/^(The|A|An)\s/i,'');
|
|
#else:
|
|
return (s || '');
|
|
#end if
|
|
},
|
|
type: 'text'
|
|
});
|
|
|
|
\$.tablesorter.addParser({
|
|
id: 'cDate',
|
|
is: function(s) {
|
|
return false;
|
|
},
|
|
format: function(s) {
|
|
return s;
|
|
},
|
|
type: 'numeric'
|
|
});
|
|
|
|
|
|
\$.tablesorter.addParser({
|
|
id: 'quality',
|
|
is: function(s) {
|
|
return false;
|
|
},
|
|
format: function(s) {
|
|
return s.replace('HD1080p',5).replace('HD720p',4).replace('HD',3).replace('SD',2).replace('Any',1).replace('Best',0).replace('Custom',7);
|
|
},
|
|
type: 'numeric'
|
|
});
|
|
|
|
\$.tablesorter.addParser({
|
|
id: 'eps',
|
|
is: function(s) {
|
|
return false;
|
|
},
|
|
format: function(s) {
|
|
match = s.match(/^(.*)/);
|
|
|
|
if (match == null || match[1] == "?")
|
|
return -10;
|
|
|
|
var nums = match[1].split(" / ");
|
|
|
|
if (parseInt(nums[0]) === 0)
|
|
return parseInt(nums[1]);
|
|
|
|
var finalNum = parseInt((nums[0]/nums[1])*1000)*100;
|
|
if (finalNum > 0)
|
|
finalNum += parseInt(nums[0]);
|
|
|
|
return finalNum;
|
|
},
|
|
type: 'numeric'
|
|
});
|
|
|
|
\$(document).ready(function(){
|
|
|
|
\$("img#network").on('error', function(){
|
|
\$(this).parent().text(\$(this).attr('alt'));
|
|
\$(this).remove();
|
|
});
|
|
|
|
\$("#showListTable:has(tbody tr)").tablesorter({
|
|
|
|
sortList: [[6,1],[2,0]],
|
|
textExtraction: {
|
|
0: function(node) { return \$(node).find("span").text().toLowerCase(); },
|
|
#if ( $layout != 'simple'):
|
|
3: function(node) { return \$(node).find("img").attr("alt"); },
|
|
#end if
|
|
4: function(node) { return \$(node).find("span").text(); },
|
|
6: function(node) { return \$(node).find("img").attr("alt"); }
|
|
},
|
|
widgets: ['saveSort', 'zebra'],
|
|
headers: {
|
|
0: { sorter: 'cDate' },
|
|
2: { sorter: 'loadingNames' },
|
|
3: { sorter: 'network' },
|
|
4: { sorter: 'quality' },
|
|
5: { sorter: 'eps' },
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
//-->
|
|
</script>
|
|
|
|
#if $varExists('header')
|
|
<h1 class="header">$header</h1>
|
|
#else
|
|
<h1 class="title">$title</h1>
|
|
#end if
|
|
|
|
<div id="HomeLayout" style="float: right; margin-top: -25px;">
|
|
<font color="red">You are using BETA software.</font><br />
|
|
<span><b>Layout:</b>
|
|
<a class="inner" href="$sbRoot/setHomeLayout/?layout=poster" style="font-size: 12px;">Poster</a> ·
|
|
<a class="inner" href="$sbRoot/setHomeLayout/?layout=banner" style="font-size: 12px;">Banner</a> ·
|
|
<a class="inner" href="$sbRoot/setHomeLayout/?layout=simple" style="font-size: 12px;">Simple</a>
|
|
</span>
|
|
</div>
|
|
|
|
<table id="showListTable" class="sickbeardTable tablesorter" cellspacing="1" border="0" cellpadding="0">
|
|
|
|
<thead><tr><th class="nowrap">Next Ep</th>#if $layout=="poster" then "<th>Poster</th>" else "<th style='display: none;'></th>"#<th>Show</th><th>Network</th><th>Quality</th><th>Downloads</th><th>Active</th><th>Status</th></tr></thead>
|
|
<tfoot>
|
|
<tr>
|
|
<th rowspan="1" colspan="1" align="center"><a href="$sbRoot/home/addShows/">  Add Show</a></th>
|
|
<th rowspan="1" colspan="7"></th>
|
|
</tr>
|
|
</tfoot>
|
|
<tbody>
|
|
|
|
#for $curLoadingShow in $sickbeard.showQueueScheduler.action.loadingShowList:
|
|
|
|
#if $curLoadingShow.show != None and $curLoadingShow.show in $sickbeard.showList:
|
|
#continue
|
|
#end if
|
|
|
|
<tr>
|
|
<td align="center">(loading)</td>
|
|
<td></td>
|
|
<td>
|
|
#if $curLoadingShow.show == None:
|
|
Loading... ($curLoadingShow.show_name)
|
|
#else:
|
|
<a href="displayShow?show=$curLoadingShow.show.indexerid">$curLoadingShow.show.name</a>
|
|
#end if
|
|
</td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
#end for
|
|
|
|
#set $myShowList = $list($sickbeard.showList)
|
|
$myShowList.sort(lambda x, y: cmp(x.name, y.name))
|
|
#for $curShow in $myShowList:
|
|
#set $curEp = $curShow.nextEpisode()
|
|
|
|
#set $curShowDownloads = [x[1] for x in $downloadedEps if int(x[0]) == $curShow.indexerid]
|
|
#set $curShowAll = [x[1] for x in $allEps if int(x[0]) == $curShow.indexerid]
|
|
#if len($curShowAll) != 0:
|
|
#if len($curShowDownloads) != 0:
|
|
#set $dlStat = str($curShowDownloads[0])+" / "+str($curShowAll[0])
|
|
#set $nom = $curShowDownloads[0]
|
|
#set $den = $curShowAll[0]
|
|
#else
|
|
#set $dlStat = "0 / "+str($curShowAll[0])
|
|
#set $nom = 0
|
|
#set $den = $curShowAll[0]
|
|
#end if
|
|
#else
|
|
#set $dlStat = "0"
|
|
#set $nom = 0
|
|
#set $den = 1
|
|
#end if
|
|
|
|
#set $which_thumb = $layout+"_thumb"
|
|
|
|
<tr>
|
|
#if len($curEp) != 0:
|
|
#set $ldatetime = $network_timezones.parse_date_time($curEp[0].airdate.toordinal(),$curShow.airs,$curShow.network)
|
|
<td align="center" class="nowrap" style="color: #555555;font-weight:bold;">$sbdatetime.sbdatetime.sbfdate($ldatetime)<span class="sort_data">$time.mktime($ldatetime.timetuple())</span> </td>
|
|
#else:
|
|
<td align="center" class="nowrap" style="color: #555555;font-weight:bold;"></td>
|
|
#end if
|
|
#if $layout == 'poster':
|
|
<td>
|
|
<div class="imgHomeWrapper $layout">
|
|
<a href="$sbRoot/showPoster/?show=$curShow.indexerid&which=$layout" rel="dialog" title="$curShow.name">
|
|
<img src="$sbRoot/showPoster/?show=$curShow.indexerid&which=$which_thumb" class="$layout" alt="$curShow.indexerid"/>
|
|
</a>
|
|
</div>
|
|
</td>
|
|
<td class="tvShow"><a href="$sbRoot/home/displayShow?show=$curShow.indexerid">$curShow.name</a></td>
|
|
#else if $layout == 'banner':
|
|
<td style="display: none;"/>
|
|
<td>
|
|
<span style="display: none;">$curShow.name</span>
|
|
<div class="imgHomeWrapper imgHomeWrapperRounded $layout">
|
|
<a href="$sbRoot/home/displayShow?show=$curShow.indexerid">
|
|
<img src="$sbRoot/showPoster/?show=$curShow.indexerid&which=$which_thumb" class="$layout" alt="$curShow.indexerid" title="$curShow.name"/>
|
|
</div>
|
|
</td>
|
|
#else if $layout == 'simple':
|
|
<td style="display: none;"/>
|
|
<td class="tvShow"><a href="$sbRoot/home/displayShow?show=$curShow.indexerid">$curShow.name</a></td>
|
|
#end if
|
|
<!--<td align="center">$curShow.network</td>//-->
|
|
<td align="center" style="color: #555555;font-weight:bold;">
|
|
#if $layout != 'simple':
|
|
#if $curShow.network:
|
|
<img id="network" width="44.8" height="22.4" src="$sbRoot/images/network/${curShow.network.lower()}.png" alt="$curShow.network" title="$curShow.network" />
|
|
#else:
|
|
<img id="network" width="44.8" height="22.4" src="$sbRoot/images/network/nonetwork.png" alt="No Network" title="No Network" />
|
|
#end if
|
|
#else:
|
|
$curShow.network
|
|
#end if
|
|
</td>
|
|
|
|
#if $curShow.quality in $qualityPresets:
|
|
<td align="center"><span class="quality $qualityPresetStrings[$curShow.quality]">$qualityPresetStrings[$curShow.quality]</span></td>
|
|
#else:
|
|
<td align="center"><span class="quality Custom">Custom</span></td>
|
|
#end if
|
|
<td align="center"><span style="display: none;">$dlStat</span><div id="progressbar$curShow.indexerid" style="position:relative;"></div>
|
|
<script type="text/javascript">
|
|
<!--
|
|
\$(function() {
|
|
\$("\#progressbar$curShow.indexerid").progressbar({
|
|
value: parseInt($nom) * 100 / parseInt($den) / 1000 });
|
|
\$("\#progressbar$curShow.indexerid").append( "<div class='progressbarText'>$dlStat</div>" )
|
|
var progressBarWidth = parseInt($nom) * 100 / parseInt($den) + "%"
|
|
\$("\#progressbar$curShow.indexerid > .ui-progressbar-value").animate({ width: progressBarWidth }, 1000);
|
|
});
|
|
//-->
|
|
</script>
|
|
</td>
|
|
<td align="center"><img src="$sbRoot/images/#if int($curShow.paused) == 0 and $curShow.status != "Ended" then "yes16.png\" alt=\"Y\"" else "no16.png\" alt=\"N\""# width="16" height="16" /></td>
|
|
<td align="center" style="color: #555555; font-weight: bold;">$curShow.status</td>
|
|
</tr>
|
|
|
|
|
|
#end for
|
|
</tbody>
|
|
</table>
|
|
|
|
#include $os.path.join($sickbeard.PROG_DIR,"gui/slick/interfaces/default/inc_bottom.tmpl")
|