mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-03 18:03:37 +00:00
440237a3c2
Change refactor restart process, reducing restart time, improving ui, and fixing web_root. Change add response handling for invalid Plex Server hosts.
440 lines
18 KiB
Cheetah
440 lines
18 KiB
Cheetah
#import sickbeard
|
|
#import datetime
|
|
#from sickbeard.common import *
|
|
#from sickbeard import sbdatetime, network_timezones
|
|
##
|
|
#set global $title = 'Home'
|
|
#set global $header = 'Show List'
|
|
#set global $sbPath = '..'
|
|
#set global $topmenu = 'home'
|
|
#set global $page_body_attr = 'show-list'
|
|
#set fuzzydate = 'airdate'
|
|
##
|
|
#import os.path
|
|
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_top.tmpl')
|
|
<script>
|
|
var config = {
|
|
isPoster: #echo ['!1','!0']['poster' == $sickbeard.HOME_LAYOUT]#,
|
|
sortArticle: #echo ['!1','!0'][$sickbeard.SORT_ARTICLE]#,
|
|
homeSearchFocus: #echo ['!1','!0'][$sickbeard.HOME_SEARCH_FOCUS]#,
|
|
fuzzyDating: #echo ['!1','!0'][$sickbeard.FUZZY_DATING]#,
|
|
timeZero: #echo ['!1','!0'][$sickbeard.TRIM_ZERO]#,
|
|
datePreset: "$sickbeard.DATE_PRESET",
|
|
timePreset: "$sickbeard.TIME_PRESET",
|
|
posterSortby: "$sickbeard.POSTER_SORTBY",
|
|
posterSortdir: #echo ['!1','!0'][$sickbeard.POSTER_SORTDIR]#,
|
|
fuzzydate: ".$fuzzydate",
|
|
};
|
|
</script>
|
|
<script type="text/javascript" src="$sbRoot/js/home.js?v=$sbPID"></script>
|
|
<h1 class="header" style="margin-bottom:0">$showlists[0][1]</h1>
|
|
|
|
<div id="HomeLayout" class="pull-right">
|
|
#set $tab = 1
|
|
#set $selected = ' selected="selected"'
|
|
#if 'poster' == $layout
|
|
<div>
|
|
<span>Sort By:
|
|
<select id="postersort" class="form-control form-control-inline input-sm" tabindex="$tab#set $tab += 1#">
|
|
<option value="name" data-sort="$sbRoot/setPosterSortBy/?sort=name"#echo $selected if 'name' == sickbeard.POSTER_SORTBY else ''#>Name</option>
|
|
<option value="date" data-sort="$sbRoot/setPosterSortBy/?sort=date"#echo $selected if 'date' == sickbeard.POSTER_SORTBY else ''#>Next Episode</option>
|
|
<option value="network" data-sort="$sbRoot/setPosterSortBy/?sort=network"#echo $selected if 'network' == sickbeard.POSTER_SORTBY else ''#>Network</option>
|
|
<option value="progress" data-sort="$sbRoot/setPosterSortBy/?sort=progress"#echo $selected if 'progress' == sickbeard.POSTER_SORTBY else ''#>Progress</option>
|
|
<option value="quality" data-sort="$sbRoot/setPosterSortBy/?sort=quality"#echo $selected if 'quality' == sickbeard.POSTER_SORTBY else ''#>Quality</option>
|
|
</select>
|
|
</span>
|
|
|
|
<span style="margin-left:5px">Sort Order:
|
|
<select id="postersortdirection" class="form-control form-control-inline input-sm" tabindex="$tab#set $tab += 1#">
|
|
<option value="true" data-sort="$sbRoot/setPosterSortDir/?direction=1"#echo $selected if 1 == sickbeard.POSTER_SORTDIR else ''#>Asc</option>
|
|
<option value="false" data-sort="$sbRoot/setPosterSortDir/?direction=0"#echo $selected if 0 == sickbeard.POSTER_SORTDIR else ''#>Desc</option>
|
|
</select>
|
|
</span>
|
|
|
|
<span style="margin-left:5px">Layout:
|
|
#else
|
|
<span class="pull-right">Layout:
|
|
#end if
|
|
<select style="margin-bottom:10px" name="layout" class="form-control form-control-inline input-sm" onchange="location = this.options[this.selectedIndex].value;" tabindex="$tab#set $tab += 1#">
|
|
<option value="$sbRoot/setHomeLayout/?layout=poster"#echo $selected if 'poster' == sickbeard.HOME_LAYOUT else ''#>Poster</option>
|
|
<option value="$sbRoot/setHomeLayout/?layout=small"#echo $selected if 'small' == sickbeard.HOME_LAYOUT else ''#>Small Poster</option>
|
|
<option value="$sbRoot/setHomeLayout/?layout=banner"#echo $selected if 'banner' == sickbeard.HOME_LAYOUT else ''#>Banner</option>
|
|
<option value="$sbRoot/setHomeLayout/?layout=simple"#echo $selected if 'simple' == sickbeard.HOME_LAYOUT else ''#>Simple</option>
|
|
</select>
|
|
</span>
|
|
|
|
#if 'poster' == $layout
|
|
</div>
|
|
#end if
|
|
<div class="pull-right" style="clear:right">
|
|
<input id="search_show_name" class="search form-control form-control-inline input-sm input200" type="search" data-column="1" placeholder="Search Show Name" tabindex="$tab#set $tab += 1#">
|
|
<button type="button" class="resetshows btn btn-inline" tabindex="$tab#set $tab += 1#">Reset Search</button>
|
|
</div>
|
|
</div><!-- /HomeLayout -->
|
|
##
|
|
#for $curShowlist in $showlists
|
|
#set $curListID = $curShowlist[0]
|
|
#set $curListName = $curShowlist[1]
|
|
#set $myShowList = $list($curShowlist[2])
|
|
#if $curShowlist != $showlists[0]
|
|
##
|
|
<h1 class="header">$curListName</h1>
|
|
|
|
#end if
|
|
##
|
|
#if 'poster' == $layout
|
|
##
|
|
<div id="$curListID" class="clearfix container" style="clear:both#if 'poster' == $layout#;padding:0#end if#">
|
|
<div class="posterview">
|
|
##
|
|
#for $curLoadingShow in $sickbeard.showQueueScheduler.action.loadingShowList
|
|
##
|
|
#if $curLoadingShow.show != None and $curLoadingShow.show in $sickbeard.showList
|
|
#continue
|
|
#end if
|
|
##
|
|
#if None is $curLoadingShow.show
|
|
##
|
|
<div class="show-card" data-name="0" data-date="010101" data-network="0">
|
|
<img alt="" title="$curLoadingShow.show_name" class="show-image" style="border-bottom:1px solid #111" src="$sbRoot/images/poster.png" />
|
|
<div class="show-details">
|
|
<div class="show-add">Loading... ($curLoadingShow.show_name)</div>
|
|
</div>
|
|
<span class="sort-data" data-progress="101"></span>
|
|
</div>
|
|
##
|
|
#end if
|
|
##
|
|
#end for
|
|
##
|
|
$myShowList.sort(lambda x, y: cmp(x.name, y.name))
|
|
#for $curShow in $myShowList
|
|
##
|
|
#set $cur_airs_next = ''
|
|
#set $cur_snatched = 0
|
|
#set $cur_downloaded = 0
|
|
#set $cur_total = 0
|
|
#set $download_stat_tip = ''
|
|
#set $display_status = $curShow.status
|
|
#set $display_name = (re.sub('^((?:A(?!\s+to)n?)|The)\s(\w)', r'<span class="article">\1</span> \2', $curShow.name), $curShow.name)[$sickbeard.SORT_ARTICLE]
|
|
#if None is not $display_status
|
|
#if re.search(r'(?i)(?:new|returning)\s*series', $curShow.status)
|
|
#set $display_status = 'Continuing'
|
|
#else if re.search(r'(?i)(?:nded)', $curShow.status)
|
|
#set $display_status = 'Ended'
|
|
#end if
|
|
#end if
|
|
##
|
|
#if $curShow.indexerid in $show_stat
|
|
#set $cur_airs_next = $show_stat[$curShow.indexerid]['ep_airs_next']
|
|
##
|
|
#set $cur_snatched = $show_stat[$curShow.indexerid]['ep_snatched']
|
|
#if not $cur_snatched
|
|
#set $cur_snatched = 0
|
|
#end if
|
|
##
|
|
#set $cur_downloaded = $show_stat[$curShow.indexerid]['ep_downloaded']
|
|
#if not $cur_downloaded
|
|
#set $cur_downloaded = 0
|
|
#end if
|
|
##
|
|
#set $cur_total = $show_stat[$curShow.indexerid]['ep_total']
|
|
#if not $cur_total
|
|
#set $cur_total = 0
|
|
#end if
|
|
#end if
|
|
##
|
|
#if $cur_total != 0
|
|
#set $download_stat = str($cur_downloaded)
|
|
#set $download_stat_tip = 'Downloaded: ' + str($cur_downloaded)
|
|
#if $cur_snatched > 0
|
|
#set $download_stat = '%s<a class="ui-font" href="%s/manage/episodeStatuses?whichStatus=2" title="View overview of snatched episodes">+%s</a>' % ($download_stat, $sbRoot, $cur_snatched)
|
|
#set $download_stat_tip = download_stat_tip + '
' + 'Snatched: ' + str($cur_snatched)
|
|
#end if
|
|
#set $download_stat = download_stat + ' / ' + str($cur_total)
|
|
#set $download_stat_tip = download_stat_tip + '
' + 'Total: ' + str($cur_total)
|
|
#else
|
|
#set $download_stat = '?'
|
|
#set $download_stat_tip = 'no data'
|
|
#end if
|
|
##
|
|
#set $nom = $cur_downloaded
|
|
#set $den = $cur_total
|
|
#if $den == 0
|
|
#set $den = 1
|
|
#end if
|
|
##
|
|
#set $progressbar_percent = $nom * 100 / $den
|
|
##
|
|
#set $data_date = '600000000000'
|
|
#if $cur_airs_next
|
|
#set $data_date = $sbdatetime.sbdatetime.convert_to_setting($network_timezones.parse_date_time($cur_airs_next, $curShow.airs, $curShow.network)).strftime('%Y%m%d%H%M')
|
|
#else if None is not $display_status
|
|
#if 'nded' not in $display_status and 1 == int($curShow.paused)
|
|
#set $data_date = '500000000500'
|
|
#else if 'ontinu' in $display_status
|
|
#set $data_date = '500000000000'
|
|
#else if 'nded' in $display_status
|
|
#set $data_date = '500000000100'
|
|
#end if
|
|
#end if
|
|
##
|
|
<div id="show$curShow.indexerid" class="show-card" data-name="$curShow.name" data-date="$data_date" data-network="$curShow.network">
|
|
<div class="show-card-top">
|
|
<div class="show-image">
|
|
<a href="$sbRoot/home/displayShow?show=$curShow.indexerid"><img alt="" class="show-image" src="$sbRoot/showPoster/?show=$curShow.indexerid&which=poster_thumb" /></a>
|
|
</div>
|
|
|
|
<div style="border-top:1px solid black;height:1px"></div>
|
|
|
|
<div class="show-title">
|
|
$display_name
|
|
</div>
|
|
|
|
<div class="show-date">
|
|
#if $cur_airs_next
|
|
#set $ldatetime = $sbdatetime.sbdatetime.convert_to_setting($network_timezones.parse_date_time($cur_airs_next,$curShow.airs,$curShow.network))
|
|
<span class="$fuzzydate">$sbdatetime.sbdatetime.sbfdate($ldatetime)</span>
|
|
#else
|
|
#set $output_html = '?'
|
|
#if None is not $display_status
|
|
#if 'nded' not in $display_status and 1 == int($curShow.paused)
|
|
#set $output_html = 'Paused'
|
|
#else if $display_status
|
|
#set $output_html = $display_status
|
|
#end if
|
|
#end if
|
|
$output_html
|
|
#end if
|
|
</div><!-- /show-date -->
|
|
|
|
<table width="100%" border="0">
|
|
<tr>
|
|
<td class="show-table">
|
|
<span class="show-dlstats" title="$download_stat_tip">$download_stat</span>
|
|
</td>
|
|
|
|
<td class="show-table show-network">
|
|
#if 'simple' == $layout
|
|
$curShow.network
|
|
#else
|
|
#set $img_text = ($curShow.network, 'No Network')[None is $curShow.network]
|
|
#if 'No Network' is not $img_text and 'nonetwork' in $network_images[$curShow.indexerid]
|
|
$curShow.network
|
|
#else
|
|
<img class="show-network-image" src="$sbRoot/images/network/$network_images[$curShow.indexerid]" alt="$img_text" title="$img_text" />
|
|
#end if
|
|
#end if
|
|
</td>
|
|
|
|
<td class="show-table">
|
|
#if $curShow.quality in $qualityPresets
|
|
<span class="show-quality">$qualityPresetStrings[$curShow.quality]</span>
|
|
#else
|
|
<span class="show-quality">Custom</span>
|
|
#end if
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div id="progressbar$curShow.indexerid"></div>
|
|
<span class="sort-data" data-progress="$progressbar_percent"></span>
|
|
</div><!-- /show$curShow.indexerid -->
|
|
|
|
#end for
|
|
</div>
|
|
</div><!-- /$curListID -->
|
|
|
|
########################
|
|
## end of poster layout
|
|
########################
|
|
#else
|
|
|
|
<table id="$curListID" class="tablesorter">
|
|
<thead>
|
|
<tr>
|
|
<th>Next Ep</th>
|
|
<th>Show</th>
|
|
<th>Network</th>
|
|
<th>Quality</th>
|
|
<th>Downloads</th>
|
|
<th>Active</th>
|
|
<th>Status</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tfoot>
|
|
<tr>
|
|
<th><a href="$sbRoot/home/addShows/">Add Show</a></th>
|
|
<th colspan="6"></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>(loading)</td>
|
|
<td class="text-left">
|
|
#if None is $curLoadingShow.show
|
|
Loading... ($curLoadingShow.show_name)
|
|
#else
|
|
<a href="$sbRoot/home/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 void = $myShowList.sort(lambda x, y: cmp(x.name, y.name))
|
|
##
|
|
#for $curShow in $myShowList
|
|
##
|
|
#set $cur_airs_next = ''
|
|
#set $cur_snatched = 0
|
|
#set $cur_downloaded = 0
|
|
#set $cur_total = 0
|
|
#set $download_stat_tip = ''
|
|
#set $display_name = (re.sub('^((?:A(?!\s+to)n?)|The)\s(\w)', r'<span class="article">\1</span> \2', $curShow.name), $curShow.name)[$sickbeard.SORT_ARTICLE]
|
|
##
|
|
#if $curShow.indexerid in $show_stat
|
|
#set $cur_airs_next = $show_stat[$curShow.indexerid]['ep_airs_next']
|
|
##
|
|
#set $cur_snatched = $show_stat[$curShow.indexerid]['ep_snatched']
|
|
#if not $cur_snatched
|
|
#set $cur_snatched = 0
|
|
#end if
|
|
##
|
|
#set $cur_downloaded = $show_stat[$curShow.indexerid]['ep_downloaded']
|
|
#if not $cur_downloaded
|
|
#set $cur_downloaded = 0
|
|
#end if
|
|
##
|
|
#set $cur_total = $show_stat[$curShow.indexerid]['ep_total']
|
|
#if not $cur_total
|
|
#set $cur_total = 0
|
|
#end if
|
|
#end if
|
|
##
|
|
#if $cur_total != 0
|
|
#set $download_stat = str($cur_downloaded)
|
|
#set $download_stat_tip = 'Downloaded: ' + str($cur_downloaded)
|
|
#if $cur_snatched > 0
|
|
#set $download_stat = '%s<a class="ui-font" href="%s/manage/episodeStatuses?whichStatus=2" title="View overview of snatched episodes">+%s</a>' % ($download_stat, $sbRoot, $cur_snatched)
|
|
#set $download_stat_tip = download_stat_tip + '
' + 'Snatched: ' + str($cur_snatched)
|
|
#end if
|
|
#set $download_stat = download_stat + ' / ' + str($cur_total)
|
|
#set $download_stat_tip = download_stat_tip + '
' + 'Total: ' + str($cur_total)
|
|
#else
|
|
#set $download_stat = '?'
|
|
#set $download_stat_tip = 'no data'
|
|
#end if
|
|
##
|
|
#set $nom = $cur_downloaded
|
|
#set $den = $cur_total
|
|
#if $den == 0
|
|
#set $den = 1
|
|
#end if
|
|
##
|
|
#set $progressbar_percent = $nom * 100 / $den
|
|
#if not $progressbar_percent
|
|
#set $progressbar_percent = (0, -1)['?' == $download_stat]
|
|
#end if
|
|
##
|
|
<tr>
|
|
#if $cur_airs_next
|
|
#set $ldatetime = $sbdatetime.sbdatetime.convert_to_setting($network_timezones.parse_date_time($cur_airs_next,$curShow.airs,$curShow.network))
|
|
<td class="text-nowrap"><div class="$fuzzydate">$sbdatetime.sbdatetime.sbfdate($ldatetime)</div><span class="sort-data">$ldatetime.strftime('%Y%m%d%H%M')</span></td>
|
|
#else
|
|
<td></td>
|
|
#end if
|
|
#if 'small' == $layout
|
|
|
|
<td class="tvShow text-left">
|
|
<div class="imgsmallposter $layout">
|
|
<a href="$sbRoot/showPoster/?show=$curShow.indexerid&which=poster" rel="dialog" title="$curShow.name">
|
|
<img src="$sbRoot/showPoster/?show=$curShow.indexerid&which=poster_thumb" class="$layout" alt="$curShow.indexerid"/>
|
|
</a>
|
|
<a href="$sbRoot/home/displayShow?show=$curShow.indexerid" style="vertical-align:middle">$display_name</a>
|
|
</div>
|
|
</td>
|
|
#else if 'banner' == $layout
|
|
|
|
<td class="text-left">
|
|
<div class="imgbanner $layout">
|
|
<a href="$sbRoot/home/displayShow?show=$curShow.indexerid">
|
|
<img src="$sbRoot/showPoster/?show=$curShow.indexerid&which=banner" class="$layout" alt="$curShow.indexerid" title="$curShow.name" />
|
|
</a>
|
|
</div>
|
|
<span class="sort-data">$display_name</span>
|
|
</td>
|
|
#else if 'simple' == $layout
|
|
|
|
<td class="tvShow text-left"><a href="$sbRoot/home/displayShow?show=$curShow.indexerid">$display_name</a></td>
|
|
#end if
|
|
#if 'simple' != $layout
|
|
#set $img_text = ($curShow.network, 'No Network')[None is $curShow.network]
|
|
|
|
<td>
|
|
#if 'No Network' is not $img_text and 'nonetwork' in $network_images[$curShow.indexerid]
|
|
$curShow.network
|
|
#else
|
|
<img width="54" height="27" src="$sbRoot/images/network/$network_images[$curShow.indexerid]" alt="#echo '%s" title="%s' % ($img_text, $img_text)#" />
|
|
<span class="sort-data">$curShow.network</span>
|
|
#end if
|
|
</td>
|
|
#else
|
|
|
|
<td class="text-left">
|
|
<span>$curShow.network</span>
|
|
<span class="sort-data">$curShow.network</span>
|
|
</td>
|
|
#end if
|
|
#if $curShow.quality in $qualityPresets
|
|
|
|
<td><span class="quality $qualityPresetStrings[$curShow.quality]">$qualityPresetStrings[$curShow.quality]</span></td>
|
|
#else
|
|
|
|
<td><span class="quality Custom">Custom</span></td>
|
|
#end if
|
|
|
|
<td>
|
|
<div id="progressbar$curShow.indexerid" style="position:relative">
|
|
<div class="progressbarText ui-font" title="$download_stat_tip">$download_stat</div>
|
|
</div>
|
|
<span class="sort-data" data-progress="$progressbar_percent"></span>
|
|
</td>
|
|
|
|
<td>
|
|
<i class=#echo '"%s" alt="%s"' % (('no', 'N'),('yes', 'Y'))[0 == int($curShow.paused) and 'Ended' != $curShow.status]#></i>
|
|
</td>
|
|
|
|
<td>
|
|
#set $display_status = $curShow.status
|
|
#if None is not $display_status
|
|
#if re.search(r'(?i)(?:new|returning)\s*series', $curShow.status)
|
|
#set $display_status = 'Continuing'
|
|
#else if re.search(r'(?i)(?:nded)', $curShow.status)
|
|
#set $display_status = 'Ended'
|
|
#end if
|
|
#end if
|
|
$display_status
|
|
</td>
|
|
</tr>
|
|
#end for
|
|
</tbody>
|
|
</table>
|
|
|
|
#end if
|
|
#end for
|
|
##
|
|
|
|
|
|
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_bottom.tmpl')
|