2023-01-12 01:04:47 +00:00
#import sickgear
#import datetime
#import re
#from sickgear . common import *
#from sickgear . helpers import anon_url
#from sickgear . indexers . indexer_config import TVINFO_TVDB , TVINFO_IMDB
#from sickgear . sgdatetime import SGDatetime
#from _23 import decode_str
<% def sg_var(varname, default=False): return getattr(sickgear, varname, default) %> #slurp #
<% def sg_str(varname, default=''): return getattr(sickgear, varname, default) %> #slurp #
<% def view_paused(result): return ((int(result['paused']) and sg_var('EPISODE_VIEW_DISPLAY_PAUSED'))
or (not int(result['paused']) and 2 != sg_var('EPISODE_VIEW_DISPLAY_PAUSED'))) %>
#slurp #
##
#set global $ title = ' Daily Schedule '
#set global $ header = ' Daily Schedule '
#set global $ sbPath = ' .. '
#set global $ topmenu = ' home '
#set $ css = $ getVar ( ' css ' , ' ' )
#set $ has_art = $ getVar ( ' has_art ' , None )
#set $ restart = ' Restart SickGear for new features on this page '
#set $ show_message = ( None , $ restart ) [ not $ varExists ( ' fanart ' ) ]
#set global $ page_body_attr = ' episode-view " class= " ' + $ css
#set theme_suffix = ( ' ' , ' -dark ' ) [ ' dark ' == $ sg_str ( ' THEME_NAME ' , ' dark ' ) ]
##
#import os . path
#include $ os . path . join ( $ sg_str ( ' PROG_DIR ' ) , ' gui/slick/interfaces/default/inc_top.tmpl ' )
<script>
<!--
var config = {hasArt: #echo ( ' !0 ' , ' !1 ' ) [ not $ has_art ] # }
//-->
</script>
#set $ sort = $ sg_var ( ' EPISODE_VIEW_SORT ' )
#set $ table_sort_header_codes = { ' time ' : 0 , ' show ' : 1 , ' network ' : 4 }
#if $ sort not in $ table_sort_header_codes
#set $ sort = ' time '
#end if
#if $ layout in [ ' daybyday ' , ' list ' ]
<script type="text/javascript" src=" $ sbRoot /js/plotTooltip.js?v= $ sbPID "></script>
#end if
#if ' daybyday ' != $ layout
<script type="text/javascript" src=" $ sbRoot /js/ajaxEpSearch.js?v= $ sbPID "></script>
<input type="hidden" id="sbRoot" value=" $ sbRoot " />
#else
<script>
<!--
#raw
$(document).ready(function(){
$(' #Carousel div [ title ] , # Carousel span[title]').tooltip({placement: 'top', html: !0});
$.sgDayContainer = [];
$.each($('[id^=day]'), function(){$.sgDayContainer.push($(' #' + $(this).attr('id')))});
jQuery.each($.sgDayContainer, function(j) {
this.isotope({
itemSelector: '.daybyday-show',
sortBy: ' $ sort ',
layoutMode: 'vertical',
transitionDuration: 0,
getSortData: {
network: function(itemElem) {
return $(itemElem).attr('data-network') || '';
},
showname: function(itemElem) {
return $(itemElem).attr('data-name') || '';
},
season: function(itemElem) {
var season = $(itemElem).attr('data-season') || '0';
return season.length && parseInt(season, 10);
},
episode: function(itemElem) {
var episode = $(itemElem).attr('data-episode') || '0';
return episode.length && parseInt(episode, 10);
},
time: function(itemElem) {
var time = $(itemElem).attr('data-time') || '0';
return time.length && parseInt(time, 10);
}
}
});
});
imagesLoaded('.daybyday-show', function() {
jQuery.each($.sgDayContainer, function(j) {
this.isotope('layout');
});
});
$.sgUiSortBy = (function(sortBy) {
var sortCriteria;
switch (sortBy) {
case 'network':
sortCriteria = ['network', 'time', 'showname', 'season', 'episode'];
break;
case 'show':
sortCriteria = ['showname', 'time', 'season', 'episode'];
break;
case 'time':
default:
sortCriteria = ['time', 'showname', 'season', 'episode'];
break;
}
jQuery.each($.sgDayContainer, function(j) {
this.isotope({
sortBy: sortCriteria,
sortAscending: 'asc' == $(' #sort - dir ' ).attr( ' data - sort - dir ' )
});
});
});
$(' #sort ' ).on( ' change ' , function() {
$.sgUiSortBy(this.value);
$.get(this.options[this.selectedIndex].getAttribute('data-sort'));
});
$(' #sort - dir ' ).on( ' click ' , function() {
var sortdir = $(this).attr('data-sort-dir'),
newdir = ('asc' == sortdir ? 'desc' : 'asc');
$(this).attr('data-sort-dir', newdir);
$(this).attr('title', 'Click to sort ' + sortdir + 'ending');
$(this).removeClass(sortdir).addClass(newdir);
$.sgUiSortBy($(' #sort ' ).val());
});
$('.carousel').on('slide.bs.carousel', function () {
imagesLoaded('.daybyday-show', function() {
jQuery.each($.sgDayContainer, function(j) {
$(this).isotope('layout');
});
});
});
$(' #card - layout ' ).on( ' click ' , function(e) {
var states$ = $(' #episode - view . daybyday ' ), isPortrait = states$.hasClass( ' portrait ' ),
state = isPortrait ? ['landscape', 'portrait'] : ['portrait', 'landscape'],
img = isPortrait ? ['poster', 'banner'] : ['banner', 'poster'],
old = img[0] + '_thumb', repl = img[1] + '_thumb',
cachedImg = $.SickGear.Root + '/images/' + repl + '.jpg',
tid, interval = 250, timeout = (5 * 1000)/interval;
states$.addClass(state[0]).removeClass(state[1]);
tid = setInterval(function() {
if (0 < $('.poster').find('img[src*="' + old + '"]').length) {
timeout--;
} else {
timeout = 0;
}
if (0 == timeout) {
clearInterval(tid);
$.each($('.poster').find('img[src*="' + cachedImg + '"]'), function() {
$(this).attr('src', $(this).attr('data-src-new')).removeAttr('data-src-new');
});
$.sgUiSortBy($(' #sort ' ).val());
$.get($.SickGear.Root + '/set_cards_daily_schedule');
}
}, interval);
$.each($('.poster').find('img[src*="' + old + '"]'), function() {
$(this).attr('data-src-new', $(this).attr('src').replace(old, repl));
$(this).attr('src', cachedImg);
});
return !1;
});
});
#end raw
//-->
</script>
#end if
<style type="text/css">
#SubMenu { display : none }
#if ' daybyday ' == $ layout
.ep-caret{cursor:pointer; vertical-align:middle; margin-right:2px}
.asc{border-top:0; border-bottom:8px solid}
.desc{border-top:8px solid; border-bottom:0}
#end if
.bfr{position:absolute;left:-999px;top:-999px}.bfr img,img.spinner,.spinner2,img.queued,img.search{display:inline-block;width:16px;height:16px}img.spinner{background:url( ${ sbRoot } /images/loading16 ${ theme_suffix } .gif) no-repeat 0 0}.spinner2{background:url( ${ sbRoot } /images/loading16-red.gif) no-repeat 0 0;margin-top:3px !important}img.queued{background:url( ${ sbRoot } /images/queued.png) no-repeat 0 0}img.search{background:url( ${ sbRoot } /images/search16.png) no-repeat 0 0}
</style>
<div class="bfr"><img src=" $ sbRoot /images/loading16 ${ theme_suffix } .gif"><img src=" $ sbRoot /images/loading16-red.gif"><img src=" $ sbRoot /images/queued.png"><img src=" $ sbRoot /images/search16.png"><img src=" $ sbRoot /images/no16.png"><img src=" $ sbRoot /images/yes16.png"></div>
#if $ show_message
2023-04-22 22:22:11 +00:00
<div class="alert alert-info" style="margin:-40px 0 50px"> $ show_message </div>
2023-01-12 01:04:47 +00:00
#end if
#if $ varExists ( ' header ' )
<h1 class="header" style="margin-bottom:0"> $ header </h1>
#else
<h1 class="title" style="margin-bottom:0"> $ title </h1>
#end if
#set $ selected = ' selected= " selected " '
<div id="HomeLayout" class="pull-right">
<div id="top-row">
<span>Layout
<select name="layout" class="form-control form-control-inline input-sm" onchange="location = this.options[this.selectedIndex].value;">
<option value=" $ sbRoot /set-layout-daily-schedule/?layout=banner" #if ' banner ' == $ sg_str ( ' EPISODE_VIEW_LAYOUT ' ) # $ selected #end if# >Banner</option>
<option value=" $ sbRoot /set-layout-daily-schedule/?layout=daybyday" #if ' daybyday ' == $ sg_str ( ' EPISODE_VIEW_LAYOUT ' , ' daybyday ' ) # $ selected #end if# >Day by Day</option>
<option value=" $ sbRoot /set-layout-daily-schedule/?layout=list" #if ' list ' == $ sg_str ( ' EPISODE_VIEW_LAYOUT ' ) # $ selected #end if# >List</option>
<option value=" $ sbRoot /set-layout-daily-schedule/?layout=poster" #if ' poster ' == $ sg_str ( ' EPISODE_VIEW_LAYOUT ' ) # $ selected #end if# >Poster</option>
</select>
</span>
<span>Sort
#if ' daybyday ' == $ layout
<span id="sort-dir" data-sort-dir="asc" class="caret ep-caret asc" title="Click to sort descending"> </span>
#end if
By
#if ' daybyday ' == $ layout
<select name="sort" id="sort" class="form-control form-control-inline input-sm">
<option value="network" data-sort=" $ sbRoot /set-sort-daily-schedule/?sort=network&redir=0" #if ' network ' == $ sort # $ selected #end if# >Network</option>
<option value="show" data-sort=" $ sbRoot /set-sort-daily-schedule/?sort=show&redir=0" #if ' show ' == $ sort # $ selected #end if# >Show</option>
<option value="time" data-sort=" $ sbRoot /set-sort-daily-schedule/?sort=time&redir=0" #if ' time ' == $ sort # $ selected #end if# >Time</option>
#else
<select name="sort" class="form-control form-control-inline input-sm" onchange="location = this.options[this.selectedIndex].value;">
<option value=" $ sbRoot /set-sort-daily-schedule/?sort=time" #if ' time ' == $ sort # $ selected #end if# >Date/Time</option>
<option value=" $ sbRoot /set-sort-daily-schedule/?sort=network" #if ' network ' == $ sort # $ selected #end if# >Network</option>
<option value=" $ sbRoot /set-sort-daily-schedule/?sort=show" #if ' show ' == $ sort # $ selected #end if# >Show</option>
#end if
</select>
</span>
<span class="no-marginr">View Paused
<select name="viewpaused" class="form-control form-control-inline input-sm" onchange="location = this.options[this.selectedIndex].value;" style="margin-bottom:10px">
<option value=" $ sbRoot /set-display-paused-daily-schedule?state=0" #if 0 == $ sg_var ( ' EPISODE_VIEW_DISPLAY_PAUSED ' ) # $ selected #end if# >Hidden</option>
<option value=" $ sbRoot /set-display-paused-daily-schedule?state=1" #if 1 == $ sg_var ( ' EPISODE_VIEW_DISPLAY_PAUSED ' ) # $ selected #end if# >Shown</option>
<option value=" $ sbRoot /set-display-paused-daily-schedule?state=2" #if 2 == $ sg_var ( ' EPISODE_VIEW_DISPLAY_PAUSED ' ) # $ selected #end if# >Only</option>
</select>
</span>
</div>
<div class="key pull-right">
#if ' daybyday ' != $ layout
<b>Key:</b>
<span class="listing-key listing-overdue">Missed</span>
<span class="listing-key listing-current">Current</span>
<span class="listing-key listing-default">Future</span>
<span class="listing-key listing-toofar">Distant</span>
#end if
#if ' daybyday ' == $ layout
<a id="card-layout" class="btn btn-inline" name="">
<span id="landscape">
<i class="sgicon-img-landscape"></i> Collapse Cards
</span>
<span id="portrait">
<i class="sgicon-img-portrait"></i> Expand Cards
</span>
</a>
#end if
<a class="btn btn-inline forceBacklog" href="webcal:// $ sbHost : $ sbHttpPort / $ sbRoot /calendar">
<i class="sgicon-cal" style="font-size:14px"></i> Webcal</a>
</div>
</div>
#if ' list ' == $ layout
<!-- start list view //-->
<script>
<!--
#raw
$.tablesorter.addParser({
id: 'loadingNames',
is: function(s) {
return false
},
format: function(s) {
if(0 == s.indexOf('Loading...'))
return s.replace('Loading...', '000')
return (s || '')
},
type: 'text'
});
$.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: 'cDate',
is: function(s) {
return false
},
format: function(s) {
return s
},
type: 'numeric'
});
$(document).ready(function(){
#end raw
var sortList = [[ $ table_sort_header_codes [ $ sort ], 0]];
#raw
$(' #showListTable : has ( tbody tr ) ' ).tablesorter( {
widgets: ['stickyHeaders'],
sortList: sortList,
textExtraction: {
0: function(node) {return $(node).find('span').text().toLowerCase() || ''},
1: function(node) {return $(node).find('a').attr('data-name') || ''},
4: function(node) {return $(node).find('span').attr('data-network') || ''},
5: function(node) {return $(node).find('span').text().toLowerCase() || ''}
},
headers: {
0: {sorter: 'cDate'},
1: {sorter: 'loadingNames'},
2: {sorter: false},
3: {sorter: false},
4: {sorter: 'loadingNames'},
5: {sorter: 'quality'},
6: {sorter: false},
7: {sorter: false},
8: {sorter: false}
}
});
$(' #sbRoot ' ).ajaxEpSearch();
#end raw
#set $ fuzzydate = ' airdate '
#if $ sg_var ( ' FUZZY_DATING ' )
fuzzyMoment({
containerClass: '. ${ fuzzydate } ',
dateHasTime: !0,
dateFormat: ' $ sg_str ('DATE_PRESET', '%x')',
timeFormat: ' $ sg_str ('TIME_PRESET', '%I:%M %p')',
trimZero: #echo ( ' !1 ' , ' !0 ' ) [ $ sg_var ( ' TRIM_ZERO ' ) ] #
});
#end if
});
//-->
</script>
#set $ show_div = ' listing-default '
<table id="showListTable" class="sickbeardTable tablesorter" cellspacing="1" border="0" cellpadding="0">
<thead>
<tr>
<th>Airdate</th>
<th>Show</th>
<th class="nowrap">Next Ep</th>
<th>Next Ep Name</th>
<th>Network</th>
<th>Quality</th>
<th>TV Info</th>
<th>Search</th>
</tr>
</thead>
<tbody style="text-shadow:none">
#for $ cur_result in $ sql_results
#set $ tvid = int ( $ cur_result [ ' indexer ' ] )
#set $ runtime = $ cur_result [ ' runtime ' ]
#set $ display_name = ( re . sub ( r ' ^((?:A(?! \ s+to)n?)|The) \ s( \ w) ' , r ' <span class= " article " > \ 1</span> \ 2 ' , $ cur_result [ ' show_name ' ] ) , $ cur_result [ ' show_name ' ] ) [ $ sg_var ( ' SORT_ARTICLE ' ) ]
#if not view_paused ( $ cur_result )
#continue
#end if
#set $ cur_ep_airdate = $ cur_result [ ' localtime ' ] . date ( )
#if $ runtime
#set $ cur_ep_enddate = $ cur_result [ ' localtime ' ] + datetime . timedelta ( minutes = $ runtime )
#if $ cur_ep_enddate < $ today
#set $ show_div = ' listing-overdue '
#elif $ cur_ep_airdate > = $ next_week . date ( )
#set $ show_div = ' listing-toofar '
#elif $ cur_ep_airdate > = $ today . date ( ) and $ cur_ep_airdate < $ next_week . date ( )
#if $ cur_ep_airdate == $ today . date ( )
#set $ show_div = ' listing-current '
#else
#set $ show_div = ' listing-default '
#end if
#end if
#end if
#set $ show_id = ' %s _ %s x %s ' % ( $ cur_result [ ' tvid_prodid ' ] , $ cur_result [ ' season ' ] , $ cur_result [ ' episode ' ] )
#set $ id_sxe = ' %s _ %s _ %s x %s ' % ( $ cur_result [ ' indexer ' ] , $ cur_result [ ' showid ' ] , $ cur_result [ ' season ' ] , $ cur_result [ ' episode ' ] )
<!-- start $ cur_result ['show_name'] //-->
<tr id="show- ${ show_id } " class=" $ show_div " data-rawname=" $ cur_result ['show_name']" data-show-id=" $ id_sxe ">
## forced to use a div to wrap airdate, the column sort went crazy with a span
<td align="center" class="nowrap">
<div class=" ${ fuzzydate } "> $ decode_str ( $ SGDatetime . sbfdatetime ( $ cur_result ['localtime']), $ sickgear . SYS_ENCODING )</div><span class="sort-data"> $ cur_result ['localtime'].strftime('%Y%m%d%H%M')</span>
</td>
<td class="tvShow"><a href=" $ sbRoot /home/view-show?tvid_prodid= $ cur_result ['tvid_prodid']" data-name=" $ cur_result ['data_show_name']"> $ display_name </a>
#if int ( $ cur_result [ ' paused ' ] )
<span class="pause">[paused]</span>
#end if
</td>
<td class="nowrap" align="center">
<%= 'S%02iE%02i' % (int(cur_result['season']), int(cur_result['episode'])) %>
</td>
<td>
#if $ cur_result [ ' description ' ]
<img alt="" src=" $ sbRoot /images/info32.png" height="16" width="16" class="plotInfo" id="plot- ${ show_id } " />
#else
<img alt="" src=" $ sbRoot /images/info32.png" width="16" height="16" class="plotInfoNone opacity40" />
#end if
$ cur_result ['name']
</td>
<td align="center">
<span data-network=" $ cur_result ['data_network']"> $ cur_result ['network']</span>
</td>
<td align="center">
#if int ( $ cur_result [ ' quality ' ] ) in $ qualityPresets
<span class="quality $ qualityPresetStrings [int( $ cur_result ['quality'])]"> $ qualityPresetStrings [int( $ cur_result ['quality'])]</span>
#else
<span class="quality Custom">Custom</span>
#end if
</td>
<td align="center" style="vertical-align:middle">
#if $ sg_var ( ' USE_IMDB_INFO ' ) and $ cur_result [ ' imdb_url ' ]
<a href="<%= anon_url(cur_result['imdb_url']) %>" rel="noreferrer" onclick="window.open(this.href, '_blank'); return false" title=" ${ cur_result [ ' imdb_url ' ] } "><img alt="[ $ sickgear . TVInfoAPI (TVINFO_IMDB).config.get('name')]" height="16" width="16" src=" $ sbRoot /images/ $ sickgear . TVInfoAPI (TVINFO_IMDB).config.get('icon')" /></a>
#end if
<a href="<%= anon_url(sickgear.TVInfoAPI(tvid).config['show_url'] % cur_result['showid']) %>" rel="noreferrer" onclick="window.open(this.href, '_blank'); return false" title=" ${ sickgear . TVInfoAPI ( $ tvid ) . config [ ' show_url ' ] % cur_result [ ' showid ' ] } "><img alt=" $ sickgear . TVInfoAPI ( $ tvid ).name" height="16" width="16" src=" $ sbRoot /images/ $ sickgear . TVInfoAPI ( $ tvid ).config['icon']" /></a>
</td>
<td align="center">
<a class="ep-search" href=" $ sbRoot /home/search-episode?tvid_prodid= $ cur_result ['tvid_prodid']&season= $ cur_result ['season']&episode= $ cur_result ['episode']" title="Manual Search"><img title="[search]" alt="[search]" height="16" width="16" src=" $ sbRoot /images/search16.png" /></a>
</td>
</tr>
<!-- end $ cur_result ['show_name'] //-->
#end for
</tbody>
<tfoot>
<tr>
<th rowspan="1" colspan="10" align="center"> </th>
</tr>
</tfoot>
</table>
<!-- end list view //-->
#else if $ layout in [ ' banner ' , ' poster ' ]
<!-- start non list view //-->
<script>
<!--
#raw
$(document).ready(function(){
$(' #sbRoot ' ).ajaxEpSearch();
$('.ep_summary').hide();
$('.ep_summaryTrigger').click(function() {
$(this).next('.ep_summary').slideToggle('normal', function() {
$(this).prev('.ep_summaryTrigger').attr('src', function(i, src) {
return $(this).next('.ep_summary').is(':visible') ? src.replace('plus','minus') : src.replace('minus','plus')
});
});
});
#end raw
#set $ fuzzydate = ' airdate '
#if $ sg_var ( ' FUZZY_DATING ' )
fuzzyMoment({
dtInline: !0,
dtGlue: ' at ',
containerClass: '. ${ fuzzydate } ',
dateHasTime: !0,
dateFormat: ' $ sg_str ('DATE_PRESET', '%x')',
timeFormat: ' $ sg_str ('TIME_PRESET', '%I:%M %p')',
trimZero: #echo ( ' !1 ' , ' !0 ' ) [ $ sg_var ( ' TRIM_ZERO ' ) ] #
});
#end if
});
//-->
</script>
#set $ cur_segment = None
#set $ too_late_header = False
#set $ missed_header = False
#set $ today_header = False
#set $ show_div = ' ep_listing listing-default '
<div style="clear:both">
#for $ x , $ cur_result in $ enumerate ( $ sql_results )
#set $ add_space = ( ' ' , ' add-space ' ) [ bool ( $ x ) ]
#set $ tvid = int ( $ cur_result [ ' indexer ' ] )
#set $ display_name = ( re . sub ( r ' ^((?:A(?! \ s+to)n?)|The) \ s( \ w) ' , r ' <span class= " article " > \ 1</span> \ 2 ' , $ cur_result [ ' show_name ' ] ) , $ cur_result [ ' show_name ' ] ) [ $ sg_var ( ' SORT_ARTICLE ' ) ]
##
#if not view_paused ( $ cur_result )
#continue
#end if
##
#set $ runtime = $ cur_result [ ' runtime ' ]
##
#if ' network ' == $ sort
##
#set $ show_network = $ cur_result [ ' network ' ] if $ cur_result [ ' network ' ] else ' no network '
#if $ cur_segment != $ show_network
#set $ cur_segment = $ cur_result [ ' network ' ]
<h2 class="network $ add_space "> $ show_network </h2>
#end if
#set $ cur_ep_airdate = $ cur_result [ ' localtime ' ] . date ( )
##
#if $ runtime
#set $ cur_ep_enddate = $ cur_result [ ' localtime ' ] + datetime . timedelta ( minutes = $ runtime )
#if $ cur_ep_enddate < $ today
#set $ show_div = ' ep_listing listing-overdue '
#elif $ cur_ep_airdate > = $ next_week . date ( )
#set $ show_div = ' ep_listing listing-toofar '
#elif $ cur_ep_enddate > = $ today and $ cur_ep_airdate < $ next_week . date ( )
#if $ cur_ep_airdate == $ today . date ( )
#set $ show_div = ' ep_listing listing-current '
#else
#set $ show_div = ' ep_listing listing-default '
#end if
#end if
#end if
#elif ' time ' == $ sort
##
#set $ cur_ep_airdate = $ cur_result [ ' localtime ' ] . date ( )
##
#if $ cur_segment != $ cur_ep_airdate
#if $ runtime
#set $ cur_ep_enddate = $ cur_result [ ' localtime ' ] + datetime . timedelta ( minutes = $ runtime )
#if $ cur_ep_enddate < $ today and $ cur_ep_airdate != $ today . date ( ) and not $ missed_header
<h2 class="day">Missed</h2>
#set $ missed_header = True
#elif $ cur_ep_airdate > = $ next_week . date ( ) and not $ too_late_header
<h2 class="day">Later</h2>
#set $ too_late_header = True
#elif $ cur_ep_enddate > = $ today and $ cur_ep_airdate < $ next_week . date ( )
#if $ cur_ep_airdate == $ today . date ( )
<h2 class="day"> $ decode_str ( $ SGDatetime . sbfdate ( $ cur_ep_airdate , '%A'), $ sickgear . SYS_ENCODING ).capitalize() <span style="font-size:14px; vertical-align:top">[Today]</span></h2>
#set $ today_header = True
#else
<h2 class="day"> $ decode_str ( $ SGDatetime . sbfdate ( $ cur_ep_airdate , '%A'), $ sickgear . SYS_ENCODING ).capitalize()</h2>
#end if
#end if
#end if
#set $ cur_segment = $ cur_ep_airdate
#end if
##
#if $ cur_ep_airdate == $ today . date ( ) and not $ today_header
<h2 class="day"> $ decode_str ( $ SGDatetime . sbfdate ( $ cur_ep_airdate , '%A'), $ sickgear . SYS_ENCODING ).capitalize() <span style="font-size:14px; vertical-align:top">[Today]</span></h2>
#set $ today_header = True
#end if
##
#if $ runtime
#set $ cur_ep_enddate = $ cur_result [ ' localtime ' ] + datetime . timedelta ( minutes = $ runtime )
#if $ cur_ep_enddate < $ today
#set $ show_div = ' ep_listing listing-overdue '
#elif $ cur_ep_airdate > = $ next_week . date ( )
#set $ show_div = ' ep_listing listing-toofar '
#elif $ cur_ep_enddate > = $ today and $ cur_ep_airdate < $ next_week . date ( )
#if $ cur_ep_airdate == $ today . date ( )
#set $ show_div = ' ep_listing listing-current '
#else
#set $ show_div = ' ep_listing listing-default '
#end if
#end if
#end if
#elif ' show ' == $ sort
#set $ cur_ep_airdate = $ cur_result [ ' localtime ' ] . date ( )
#slurp
#if $ runtime
#set $ cur_ep_enddate = $ cur_result [ ' localtime ' ] + datetime . timedelta ( minutes = $ runtime )
#if $ cur_ep_enddate < $ today
#set $ show_div = ' ep_listing listing-overdue listingradius '
#elif $ cur_ep_airdate > = $ next_week . date ( )
#set $ show_div = ' ep_listing listing-toofar listingradius '
#elif $ cur_ep_enddate > = $ today and $ cur_ep_airdate < $ next_week . date ( )
#if $ cur_ep_airdate == $ today . date ( )
#set $ show_div = ' ep_listing listing-current listingradius '
#else
#set $ show_div = ' ep_listing listing-default listingradius '
#end if
#end if
#end if
#end if
#slurp
<!-- start $ cur_result ['show_name'] //-->
#set $ id_sxe = ' %s _ %s _ %s x %s ' % ( $ cur_result [ ' indexer ' ] , $ cur_result [ ' showid ' ] , $ cur_result [ ' season ' ] , $ cur_result [ ' episode ' ] )
<div class=" $ show_div " id="listing- $ cur_result ['tvid_prodid']" data-show-id=" $ id_sxe ">
<div class="tvshowDiv">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<th #if ' banner ' == $ layout then ' class= " nobg " ' else ' rowspan= " 2 " ' # valign="top">
<a href=" $ sbRoot /home/view-show?tvid_prodid= $ cur_result ['tvid_prodid']"><img alt="" class=" #if ' banner ' == $ layout then ' bannerThumb ' else ' posterThumb ' # " src=" $ sbRoot /show-poster/?tvid_prodid= $ cur_result ['tvid_prodid']&which= #if ' poster ' == $ layout then ' poster_thumb ' else $ layout # " /></a>
</th>
#if ' banner ' == $ layout
</tr>
<tr>
#end if
<td class="next_episode">
<div class="clearfix">
<span class="tvshowTitle">
<a href=" $ sbRoot /home/view-show?tvid_prodid= $ cur_result ['tvid_prodid']" data-name=" $ cur_result ['data_show_name']"> $ display_name
#if int ( $ cur_result [ ' paused ' ] )
<span class="pause">[paused]</span>
#end if
</a></span>
<span class="tvshowTitleIcons">
#if $ sg_var ( ' USE_IMDB_INFO ' ) and $ cur_result [ ' imdb_url ' ]
<a href="<%= anon_url(cur_result['imdb_url']) %>" rel="noreferrer" onclick="window.open(this.href, '_blank'); return false" title=" ${ cur_result [ ' imdb_url ' ] } "><img alt="[ $ sickgear . TVInfoAPI (TVINFO_IMDB).name]" height="16" width="16" src=" $ sbRoot /images/ $ sickgear . TVInfoAPI (TVINFO_IMDB).config.get('icon')" /></a>
#end if
<a href="<%= anon_url(sickgear.TVInfoAPI(tvid).config['show_url'] % cur_result['showid']) %>" rel="noreferrer" onclick="window.open(this.href, '_blank'); return false" title=" ${ sickgear . TVInfoAPI ( $ tvid ) . config [ ' show_url ' ] % cur_result [ ' showid ' ] } "><img alt=" $ sickgear . TVInfoAPI ( $ tvid ).name" height="16" width="16" src=" $ sbRoot /images/ $ sickgear . TVInfoAPI ( $ tvid ).config['icon']" /></a>
<span><a class="ep-search" href=" $ sbRoot /home/search-episode?tvid_prodid= $ cur_result ['tvid_prodid']&season= $ cur_result ['season']&episode= $ cur_result ['episode']" title="Manual Search"><img title="[search]" alt="[search]" height="16" width="16" src=" $ sbRoot /images/search16.png" /></a></span>
</span>
</div>
<span class="title">Next Episode:</span> <span><%= 'S%02iE%02i' % (int(cur_result['season']), int(cur_result['episode'])) %> - $ cur_result ['name']</span>
<div class="clearfix">
<span class="title">Airdate: </span><span class=" ${ fuzzydate } "> $ decode_str ( $ SGDatetime . sbfdatetime ( $ cur_result ['localtime']), $ sickgear . SYS_ENCODING )</span><%= ('', '<span> on %s</span>' % str(cur_result['network']))[None is not cur_result['network']] %>
</div>
<div class="clearfix">
<span class="title">Quality:</span>
#if int ( $ cur_result [ ' quality ' ] ) in $ qualityPresets
<span class="quality $ qualityPresetStrings [int( $ cur_result ['quality'])]"> $ qualityPresetStrings [int( $ cur_result ['quality'])]</span>
#else
<span class="quality Custom">Custom</span>
#end if
</div>
</td>
</tr>
<tr>
<td style="vertical-align:top">
<div>
#if $ cur_result [ ' description ' ]
<span class="title" style="vertical-align:middle">Plot:</span>
<img class="ep_summaryTrigger" src=" $ sbRoot /images/plus.png" height="16" width="16" alt="" title="Toggle Summary" /><div class="ep_summary"> $ cur_result ['description']</div>
#else
<span class="title ep_summaryTriggerNone" style="vertical-align:middle">Plot:</span>
<img class="ep_summaryTriggerNone" src=" $ sbRoot /images/plus.png" height="16" width="16" alt="" />
#end if
</div>
</td>
</tr>
</table>
</div>
</div>
<!-- end $ cur_result ['show_name'] //-->
#end for
</div>
<!-- end non list view //-->
#end if
##
#if ' daybyday ' == $ layout
##
#set $ shows_overdue = [ ]
#set $ shows_soon = [ ]
#set $ shows_future = [ ]
#set $ onair = [ ]
#set $ backart = [ ]
#set $ state_overdue = ' listing-overdue '
#set $ state_current = ' listing-current '
#set $ state_soon = ' listing-soon '
#set $ state_future = ' listing-default '
#for $ cur_result in $ sql_results
#if not view_paused ( $ cur_result )
#continue
#end if
#if $ cur_result [ ' runtime ' ]
#set $ air_date = $ cur_result [ ' localtime ' ] . date ( )
#set $ end_datetime = $ cur_result [ ' localtime ' ] + datetime . timedelta ( minutes = $ cur_result [ ' runtime ' ] )
#if $ air_date > = $ next_week . date ( )
#set $ cur_result [ ' state ' ] = ' '
$ shows_future . append ( $ cur_result )
#elif $ cur_result [ ' localtime ' ] > $ today
#set $ cur_result [ ' state ' ] = ' '
$ shows_soon . append ( $ cur_result )
#set $ dif = $ cur_result [ ' localtime ' ] - $ today
#set $ until_hrs = ( divmod ( $ dif . days * 86400 + $ dif . seconds , 60 ) [ 0 ] ) / 60
#if 24 > = $ until_hrs and $ cur_result [ ' tvid_prodid ' ] not in $ backart
$ backart . append ( $ cur_result ['tvid_prodid'])
#end if
#elif $ end_datetime > $ today
#set $ cur_result [ ' state ' ] = $ state_current
#set $ cur_result [ ' state-title ' ] = ' Currently On Air '
$ shows_soon . append ( $ cur_result )
#if $ cur_result [ ' tvid_prodid ' ] not in $ onair
$ onair . append ( $ cur_result ['tvid_prodid'])
#end if
#elif $ air_date == $ today . date ( )
#set $ cur_result [ ' state ' ] = $ state_overdue
#set $ cur_result [ ' state-title ' ] = ' Overdue '
$ shows_soon . append ( $ cur_result )
#else
#set $ cur_result [ ' state ' ] = $ state_overdue
#set $ cur_result [ ' state-title ' ] = ' Overdue '
$ shows_overdue . append ( $ cur_result )
#end if
#else
#set $ cur_result [ ' state ' ] = $ state_soon
#set $ cur_result [ ' state-title ' ] = ' '
$ shows_soon . append ( $ cur_result )
#end if
#end for
##set $state_init = [int(bool($shows_overdue)), ($state_soon, $state_overdue)[0 < len($shows_overdue)]] ## default overdue
#set $ state_init = [ int ( bool ( $ shows_overdue ) ) , $ state_soon ] # # default soon
#set $ dates_future = sorted ( { $ i [ ' localtime ' ] . date ( ) : $ i for $ i in $ shows_future } )
#set $ rounded_week = int ( len ( $ dates_future ) / 7 * 7 + int ( bool ( len ( $ dates_future ) % 7 ) ) * 7 )
<% dates_future += [dates_future[-1] + datetime.timedelta(days = 1 + i) for i in range(rounded_week - len(dates_future))] %>
#set $ num_weeks = int ( $ rounded_week / 7 )
#slurp
<span style="position:absolute;left:-999px;height:0px">
<img src=" $ sbRoot /images/poster_thumb.jpg" alt=""><img src=" $ sbRoot /images/banner_thumb.jpg" alt="">
</span>
#if $ varExists ( ' fanart ' )
<div id="background-container">
#set $ backlist = $ backart
#if $ onair
#import random
$ random . shuffle ( $ onair )
#set $ backlist = $ onair
#end if
#if len ( $ backlist )
<ul>
#set $ start_image = True
#for $ show_id in $ backlist
#for ( $ image , $ rating ) in $ fanart . get ( $ show_id , [ ] )
<li class=" #echo ' ' . join ( ( x for x in ( { 10 : ' group ' , 20 : ' fave ' , 30 : ' avoid ' } . get ( $ rating , ' ' ) , ( ' ' , ' background first-load ' ) [ $ start_image ] ) if x ) ) # " style="background-image:url( $ sbRoot /show-poster/?tvid_prodid= $ show_id &which=fanart_ $ image )"></li>
#set $ start_image = False
#end for
#end for
</ul>
#end if
</div>
#end if
<div class="daybydayCarouselContainer">
<div id="Carousel" class="carousel slide">
#set $ wide = int ( 0 < len ( $ shows_overdue ) ) + $ num_weeks
<div class="controlsBlock" style=" #if $ wide # width: #echo 42 + ( ( $ wide + 1 ) * 22 ) + 15 # px #else # background:transparent #end if# ">
#if $ wide
<a class="left carousel-control" href=" #Carousel " data-slide= " prev " ><i class= " glyphicon glyphicon - chevron - left " ></i></a>
<a class="right carousel-control" href=" #Carousel " data-slide= " next " ><i class= " glyphicon glyphicon - chevron - right " ></i></a>
<ul class="carousel-indicators">
#set $ slide_id = 0
#if len ( $ shows_overdue )
<li data-target=" #Carousel " data-slide-to= " $ slide_id " class= " $ state_overdue # if $ state_init [1] == $ state_overdue then ' active' else '' #"></li>
#set $ slide_id = 1
#end if
<li data-target=" #Carousel " data-slide-to= " $ slide_id " class= " $ state_soon # if $ state_init [1] == $ state_soon then ' active' else '' #"></li>
#set $ slide_id + = 1
#for $ i in range ( $ slide_id , $ slide_id + $ num_weeks )
<li data-target=" #Carousel " data-slide-to= " $ { i } " class= " $ state_future # if $ state_init [1] == $ state_future and $ state_init [0] == $i then ' active' else '' #"></li>
#end for
</ul>
#end if
</div>
<div class="carousel-inner">
#for $ shows , $ state in [ [ $ shows_overdue , $ state_overdue ] , [ $ shows_soon , $ state_soon ] , [ $ shows_future , $ state_future ] ]
#if 0 == len ( $ shows ) and ( $ state_overdue == $ state or $ state_future == $ state )
#continue
#end if
#set $ week_num = 0
#set $ num_weeks = 1
#while ( $ num_weeks )
#if $ state_future == $ state
#set $ dates = $ dates_future [ $ week_num * 7 : $ week_num * 7 + 7 ]
#if 0 == $ week_num
#set $ num_weeks = int ( $ rounded_week / 7 )
#end if
#set $ week_num + = 1
#else
## hack to make var available in local context
#set $ today = $ today
<% dates = [(today + datetime.timedelta(days = (i, -7+i)[state_overdue == state])).date() for i in range(7)] %>
#end if
#set $ num_weeks - = 1
<div class="item #if $ state_init [ 1 ] == $ state then ' active ' else ' ' # "> <!-- start $ state -->
<div class="daybydayWrapper">
#set $ tbl_day = 0
#for $ day in $ dates
##
#set $ tbl_day + = 1
##
#set $ col_class = ' '
#if 1 == $ tbl_day and $ state_soon == $ state
#set $ col_class = ' today '
#end if
#set $ col_class = ' %s %s ' % ( $ col_class , ( ' even ' , ' odd ' ) [ 1 == tbl_day % 2 ] )
<div class="day-of-week $ col_class ">
<div class="day-number">
<div class="number"> $ decode_str ( $ SGDatetime . sbfdate ( $ day , ' %d'), $ sickgear . SYS_ENCODING ).replace(' 0', ' ')</div>
<div class="day">
<span class="visible-lg"> $ decode_str ( $ SGDatetime . sbfdate ( $ day , '%A'), $ sickgear . SYS_ENCODING ).capitalize()</span>
<span class="hidden-lg"> $ decode_str ( $ SGDatetime . sbfdate ( $ day , '%a'), $ sickgear . SYS_ENCODING ).capitalize()</span>
</div>
<div class="month">
<span class="visible-lg"> $ decode_str ( $ SGDatetime . sbfdate ( $ day , '%B'), $ sickgear . SYS_ENCODING ).capitalize()</span>
<span class="hidden-lg"> $ decode_str ( $ SGDatetime . sbfdate ( $ day , '%b'), $ sickgear . SYS_ENCODING ).capitalize()</span>
</div>
</div>
<div id=" $ SGDatetime . sbfdate ( $ day , 'day%j')">
#set $ day_has_show = False
#for $ cur_result in $ shows
#if $ day == $ cur_result [ ' localtime ' ] . date ( )
#set $ day_has_show = True
#set $ airtime = $ decode_str ( $ SGDatetime . sbftime ( $ cur_result [ ' localtime ' ] , markup = True ) , $ sickgear . SYS_ENCODING )
#set $ img_id = ' '
#set $ plot_class = ' '
#set $ title_text = ' '
#set $ show_id = ' %s _ %s x %s ' % ( $ cur_result [ ' tvid_prodid ' ] , str ( $ cur_result [ ' season ' ] ) , str ( $ cur_result [ ' episode ' ] ) )
#set $ img_id = ' id= " plot- %s " ' % $ show_id
#set $ plot_class = ' plot-daybyday '
<div id="show- ${ show_id } " class="daybyday-show" data-name=" $ cur_result ['data_show_name']" data-season=" $ cur_result ['season']" data-episode=" $ cur_result ['episode']" data-network=" $ cur_result ['data_network']" data-time=" $ cur_result ['localtime'].strftime('%Y%m%d%H%M')" data-rawname=" $ cur_result ['show_name']">
<div class="poster">
<a ${ title_text } href=" $ sbRoot /home/view-show?tvid_prodid= $ cur_result ['tvid_prodid']">
<img ${ img_id } class="img-responsive ${ plot_class } " alt="" src=" $ sbRoot /show-poster/?tvid_prodid= $ cur_result ['tvid_prodid']&which= #echo ( ' banner ' , ' poster ' ) [ $ bool ( $ sg_var ( ' EPISODE_VIEW_POSTERS ' , True ) ) ] # _thumb" /></a>
</div>
<div class="state #if len ( $ cur_result [ ' state ' ] ) then ' %s " title= " %s " ' % ( $ cur_result [ ' state ' ] , $ cur_result [ ' state-title ' ] ) else ' " ' # ></div>
<div class="text">
<div class="airtime">
#set $ match = None if not $ cur_result [ ' network ' ] else re . search ( r ' (.*) \ s( \ ( \ w+ \ ))$ ' , $ cur_result [ ' network ' ] , re . I | re . M )
<span class="time"> ${ airtime } </span> <span class="network pull-right grey-text" #echo ' > %s ' % $ cur_result [ ' network ' ] if None is $ match else ' title= " %s " > %s ' % ( $ match . group ( 2 ) , $ match . group ( 1 ) ) # </span>
</div>
<div class="episode" title=" $ cur_result ['name']">
<span class="season"><%= '%i' % int(cur_result['season']) %></span>x<span class="number"><%= '%02i' % int(cur_result['episode']) %></span>
<span class="name"> $ cur_result ['name']</span>
</div>
</div>
#if int ( $ cur_result [ ' paused ' ] )
<span class="over-layer0">[paused]</span>
<span class="over-layer1">[paused]</span>
#elif $ state_current == $ cur_result [ ' state ' ]
#set $ endtime = $ decode_str ( $ SGDatetime . sbftime ( $ cur_result [ ' localtime ' ] + datetime . timedelta ( minutes = $ cur_result [ ' runtime ' ] ) , markup = True ) , $ sickgear . SYS_ENCODING )
<span class="over-layer0 on-air0">On Air until<br /> $ endtime </span>
<span class="over-layer1 on-air1">On Air until<br /> $ endtime </span>
#end if
</div><!-- end show- $ cur_result ['tvid_prodid'] //-->
#end if
#end for
#if not $ day_has_show
<div class="daybyday-show">
#set $ theday = ( ' this ' , ' to ' ) [ 1 == $ tbl_day and $ state_soon == $ state ]
<span class="episode-blank">No shows ${ theday } day</span>
</div>
#end if
</div>
</div>
#end for
</div> <!-- end daybydayWrapper //-->
</div> <!-- end $ state //-->
#end while
#end for
</div> <!-- end carouselinner //-->
</div> <!-- end Carousel //-->
</div> <!-- end daybydayCarouselContainer //-->
<!-- end daybyday view //-->
#end if
<div class="clearfix"></div>
#raw
<script>
<!--
window.setInterval('location.reload(true)', 30*60000); // Refresh every xx minutes
$(' #Carousel ' ).carousel( {interval: 0} );
$(document).bind('keyup', function(e) {
return (/undefined/i.test($.SickGear.PauseCarousel) &&
(!('ctrlKey' in e && !!e.ctrlKey) && !('shiftKey' in e && !!e.shiftKey) && !(('altKey' in e && !!e.altKey) || ('metaKey' in e && !!e.metaKey))) && (
(!(e.hasOwnProperty('ctrlKey') && e.ctrlKey) && !(e.hasOwnProperty('altKey') && e.altKey)) && (
(39 == e.which && $('.carousel').carousel('next')) ||
(37 == e.which && $('.carousel').carousel('prev'))) || !0));
});
//-->
</script>
#end raw
#if $ varExists ( ' fanart ' ) and $ layout in ' daybyday '
#include $ os . path . join ( $ sg_str ( ' PROG_DIR ' ) , ' gui/slick/interfaces/default/inc_livepanel.tmpl ' )
#end if
#include $ os . path . join ( $ sg_str ( ' PROG_DIR ' ) , ' gui/slick/interfaces/default/inc_bottom.tmpl ' )