mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-21 10:13:39 +00:00
fce8878fa9
Add top rated, popular, trending today, trending this week, to TMDB cards. Change Shows/Add show... Trakt and IMDb card descriptions to be dynamic. Add network data to trakt cards. Add fallback for show cast when no suitable items are found in tvdb_api. Change refactor for trakt lib update. Change sanitise api response dates for cards (an invalid trakt date caused a UI glitch). Fix issue where trakt can return no tvdb id causing a card to not display. Change view-show TVDb genre links to use anon link setting. Change remove displayShow.tmpl code for '|' sep as it is a fixed list string at data source. Change add TVINFO_FANSITE placeholder icon. Change refactor api sg.`CMD_SickGearShowsBrowseTrakt`. --- Refactor date handling to make it's usage consistent from indexerapi Split when_past out to to started_past and return_past for UI. Fix trakt returning dates. Change bring properly into use, the proper new season returning date. Change remove PY2 unused import statements. --- Fix issue with Trakt cards where an incorrect cache image obscures the default card placeholder image. Simplify airtime for cards. Remove nonsense TMDB api overview text. Rearrange cards order on top menu. --- Remove unused vars and simplify regex use cases. Fix tv cards issue with Trakt and Tvmaze where show_info does not carry a first episode_info. Instantiate with TVInfoEpisode() instead of None, so that expected properties exist without a need for Nonetype tests. Change simplify `overview` and `airtime` use after lib output type is made trustable. Change cards view to not allow items with no seriesname.
614 lines
27 KiB
Cheetah
614 lines
27 KiB
Cheetah
#import sickgear
|
|
#import re
|
|
#from sickgear import WEB_ROOT, THEME_NAME
|
|
#from sickgear.common import *
|
|
#from sickgear.helpers import anon_url, try_float
|
|
#from _23 import quote
|
|
<% def sg_var(varname, default=False): return getattr(sickgear, varname, default) %>#slurp#
|
|
<% def sg_str(varname, default=''): return getattr(sickgear, varname, default) %>#slurp#
|
|
##
|
|
#set $mode = $kwargs and $kwargs.get('mode', '')
|
|
#set $use_network = $kwargs.get('use_networks', False)
|
|
#set $use_returning = 'returning' == mode
|
|
#set $use_filter = $kwargs and $kwargs.get('use_filter', True)
|
|
#set $use_ratings = $kwargs and $kwargs.get('use_ratings', True)
|
|
#set $use_votes = $kwargs and $kwargs.get('use_votes', True)
|
|
#set $term_vote = $kwargs and $kwargs.get('term_vote', 'Votes')
|
|
##
|
|
#set global $title='Browse %s Shows' % $browse_type
|
|
#set global $header='Browse Shows'
|
|
#set global $sbPath='..'
|
|
#set global $topmenu='home'
|
|
#set global $page_body_attr = 'browse-list" class="%s%s' % ($browse_type.lower(), ('', ' no-votes')[not $use_votes])
|
|
#set sg_root = $getVar('sbRoot', WEB_ROOT)
|
|
##
|
|
#import os.path
|
|
#include $os.path.join($sg_str('PROG_DIR'), 'gui/slick/interfaces/default/inc_top.tmpl')
|
|
<script>
|
|
var config = {
|
|
homeSearchFocus: #echo ['!1','!0'][$sg_var('HOME_SEARCH_FOCUS', True)]#,
|
|
};
|
|
</script>
|
|
<script type="text/javascript" src="$sg_root/js/plotTooltip.js?v=$sbPID"></script>
|
|
|
|
<script type="text/javascript" charset="utf-8">
|
|
<!--
|
|
#raw
|
|
var addQTip = (function(){
|
|
$(this).css('cursor', 'help');
|
|
$(this).qtip({
|
|
show: {solo:true},
|
|
position: {viewport:$(window), my:'left center', adjust:{y: -10,x: 2 }},
|
|
style: {tip: {corner:true, method:'polygon'}, classes:'qtip-rounded qtip-bootstrap qtip-shadow ui-tooltip-sb'}
|
|
});
|
|
}),
|
|
llUpdate = (function(){
|
|
$.ll.handleScroll();
|
|
});
|
|
|
|
savePrefs = (function(){
|
|
var showsort = [], showfilter = [];
|
|
|
|
$('#showsort').find('.selected').each(function(n, item){
|
|
showsort[n] = item.value;
|
|
});
|
|
$('#showfilter').find('.selected').each(function(n, item){
|
|
showfilter[n] = item.value;
|
|
});
|
|
|
|
$.getJSON($.SickGear.Root + '/add-shows/browse-mru', {
|
|
browse_type: '#end raw#$browse_type#raw#',
|
|
showsort: showsort.join(','), showfilter: showfilter.join(',')
|
|
});
|
|
});
|
|
|
|
$(document).ready(function(){
|
|
// initialise combos for dirty page refreshes
|
|
$('#showsort').val('#end raw#$saved_showsort_view#raw#');
|
|
|
|
$.iso = $('#container').isotope({
|
|
itemSelector: '.show-card',
|
|
sortBy: '#end raw##if $reset_showsort_sortby#by_order#else#$saved_showsort_sortby#end if##raw#',
|
|
sortAscending: '#end raw##if $is_showsort_desc#desc#else#asc#end if##raw#',
|
|
layoutMode: 'masonry',
|
|
masonry: {
|
|
columnWidth: 188,
|
|
isFitWidth: !0,
|
|
gutter: 12
|
|
},
|
|
getSortData: {
|
|
premiered: '[data-premiered] parseInt',
|
|
name: function( itemElem ) {
|
|
var name = $( itemElem ).attr('data-name') || '';
|
|
#end raw
|
|
#if not $sg_var('SORT_ARTICLE')
|
|
name = name.replace(/^(?:(?:A(?!\s+to)n?)|The)\s(\w)/i, '$1');
|
|
#end if
|
|
return name.toLowerCase();
|
|
},
|
|
#if $use_returning
|
|
#raw
|
|
returning: function( itemElem ) {
|
|
return $( itemElem ).attr('data-returning') || '';
|
|
},
|
|
#end raw
|
|
#end if
|
|
#if $use_ratings
|
|
rating: '[data-rating] parseFloat',
|
|
#end if
|
|
#if $use_votes
|
|
votes: '[data-votes] parseInt',
|
|
#end if
|
|
order: '[data-order] parseInt',
|
|
}
|
|
});
|
|
#raw
|
|
$('#showsort').on('change', function(){
|
|
var elValue = this.value, sortCriteria = elValue.replace('by_', ''), el$ = $('#container'), shuffle = !1;
|
|
switch (sortCriteria) {
|
|
case 'asc':
|
|
case 'desc':
|
|
sortCriteria = 'direction';
|
|
break;
|
|
#end raw
|
|
case 'order':
|
|
case 'premiered':
|
|
#if $use_returning
|
|
case 'returning':
|
|
#end if
|
|
#if $use_votes
|
|
case 'votes':
|
|
#end if
|
|
break;
|
|
#if $use_ratings
|
|
#if $use_votes
|
|
case 'rating_votes':
|
|
sortCriteria = ['rating', 'votes'];
|
|
#end if
|
|
case 'rating':
|
|
shuffle = !0;
|
|
break;
|
|
#end if
|
|
default:
|
|
sortCriteria = 'name'
|
|
break;
|
|
}
|
|
|
|
#raw
|
|
var option$, showSort = $('#showsort option');
|
|
if('direction' === sortCriteria){
|
|
option$ = showSort.filter('option[value="asc"].selected, option[value="desc"].selected');
|
|
option$.removeClass('selected').removeAttr('selected').html(option$.text().replace(/^>\s/i, ''));
|
|
|
|
option$ = showSort.filter($('option[value="' + elValue + '"]'));
|
|
option$.addClass('selected').attr('selected', !0).html('> ' + option$.text());
|
|
|
|
savePrefs();
|
|
|
|
el$.one('layoutComplete', llUpdate);
|
|
el$.isotope({
|
|
sortAscending: 'asc' === elValue,
|
|
sortBy: showSort.filter($('option[value^="by_"][class*="selected"]')).val().replace('by_', '')
|
|
});
|
|
} else if(0 == elValue.indexOf('by_')){
|
|
option$ = showSort.filter($('option[value^="by_"][class*="selected"]'));
|
|
option$.removeClass('selected').removeAttr('selected').html(option$.text().replace(/^>\s/i, ''));
|
|
|
|
option$ = showSort.filter($('option[value="' + elValue + '"]'));
|
|
option$.addClass('selected').attr('selected', !0).html('> ' + option$.text());
|
|
|
|
savePrefs();
|
|
|
|
if (!shuffle){
|
|
el$.one('layoutComplete', llUpdate);
|
|
el$.isotope({sortBy: sortCriteria});
|
|
} else {
|
|
// shuffle rating_votes where it can already be sorted by ratings which leaves it nothing to do.
|
|
function t(sortCriteria, lastPhase){
|
|
return function(){
|
|
var el$ = $('#container');
|
|
if (!lastPhase){
|
|
lastPhase = !0;
|
|
el$.isotope({sortBy: sortCriteria});
|
|
} else {
|
|
el$.off('layoutComplete');
|
|
el$.isotope('layout');
|
|
llUpdate();
|
|
}
|
|
}
|
|
}
|
|
el$.on('layoutComplete', t(sortCriteria, !1));
|
|
el$.isotope({sortBy: 'random'});
|
|
}
|
|
} else {
|
|
option$ = showSort.filter($('option[value^="*"].selected, #showsort option[value^="."].selected'));
|
|
option$.removeClass('selected').removeAttr('selected').html(option$.text().replace(/^>\s/i, ''));
|
|
|
|
option$ = showSort.filter($('option[value="' + elValue + '"]'));
|
|
option$.addClass('selected').attr('selected', !0).html('> ' + option$.text());
|
|
|
|
savePrefs();
|
|
|
|
var showCards = $('.show-card'), filter = elValue;
|
|
if('.hide' === filter){
|
|
showCards.filter($('.hide')).removeClass('hide').addClass('to-hide');
|
|
filter = '.to-hide';
|
|
} else {
|
|
showCards.filter($('.to-hide')).removeClass('to-hide').addClass('hide');
|
|
}
|
|
|
|
var el$ = $('#container');
|
|
el$.off('layoutComplete');
|
|
el$.on('revealComplete', llUpdate);
|
|
el$.on('hideComplete', llUpdate);
|
|
el$.isotope({ filter: filter });
|
|
}
|
|
});
|
|
|
|
$('#container').on('click', '.show-toggle-hide', function(event){
|
|
var that = $(this);
|
|
event.preventDefault();
|
|
|
|
$.getJSON(this.href, function(data){
|
|
if(data.success){
|
|
var showCards = $('.show-card'), thisCard = $(that).parents('div[class*="show-card "]'),
|
|
numShows = showCards.length, numHidden, showSort = $('#showsort option'), filter = 'to-hide';
|
|
|
|
if(thisCard.hasClass(filter)){
|
|
title = 'Hide';
|
|
thisCard.removeClass(filter);
|
|
} else {
|
|
filter = 'hide';
|
|
title = 'Unhide';
|
|
thisCard.addClass(filter);
|
|
}
|
|
numHidden = showCards.filter($('.' + filter)).length;
|
|
that.attr('title', title);
|
|
|
|
showSort.filter($('option[value=".hide"]')).text('Hidden (' + numHidden + ')');
|
|
showSort.filter($('option[value="*"]')).text('All (' + (0 == numHidden ? '' : (numShows - numHidden) + '/') + numShows + ')');
|
|
|
|
var el$ = $('#container')
|
|
el$.on('layoutComplete', llUpdate);
|
|
el$.isotope();
|
|
}
|
|
});
|
|
});
|
|
|
|
$('#showfilter').on('change', function(){
|
|
var filterValue = this.value;
|
|
if (-1 == filterValue.indexOf('trakt') && -1 == filterValue.indexOf('imdb') && -1 == filterValue.indexOf('mc_')
|
|
&& -1 == filterValue.indexOf('tmdb_') && -1 == filterValue.indexOf('tvc_')
|
|
&& -1 == filterValue.indexOf('tvm_')
|
|
&& -1 == filterValue.indexOf('ne_') && -1 == filterValue.indexOf('_ne')
|
|
&& -1 == filterValue.indexOf('default')) {
|
|
var el$ = $('#container')
|
|
el$.on('layoutComplete', llUpdate);
|
|
el$.isotope({ filter: filterValue });
|
|
} else {
|
|
if (-1 !== filterValue.indexOf('more_imdb')){
|
|
filterValue = $('#showfilter').find('option:not([value="more_imdb"]).selected').val() + '&more=1';
|
|
}
|
|
else if (-1 !== filterValue.indexOf('more_ne')){
|
|
filterValue = $('#showfilter').find('option:not([value^="more_"]).selected').val() + '?more=1';
|
|
}
|
|
#end raw
|
|
location = '$sg_root/add-shows/' + filterValue;
|
|
#raw
|
|
}
|
|
});
|
|
|
|
$('.service, .browse-image').each(addQTip);
|
|
|
|
if (config.homeSearchFocus) {
|
|
$('#search_show_name').focus();
|
|
}
|
|
llUpdate = (function(){
|
|
$.ll.handleScroll();
|
|
});
|
|
$('#search_show_name').on('input', function() {
|
|
var obj = $('#container');
|
|
obj.one('layoutComplete', llUpdate);
|
|
obj.isotope({
|
|
filter: function () {
|
|
var reSearch = RegExp($('#search_show_name').val(), 'i');
|
|
return reSearch.test($(this).attr('data-name'))#end raw##slurp#
|
|
#if $use_network#
|
|
|| reSearch.test(\$(this).attr('data-network'))#end if#;
|
|
#raw
|
|
}
|
|
});
|
|
});
|
|
$('.resetshows').click(function() {
|
|
var input = $('#search_show_name');
|
|
if ('' !== input.val()){
|
|
input.val('').trigger('input').change();
|
|
if (config.homeSearchFocus)
|
|
input.focus();
|
|
}
|
|
});
|
|
});
|
|
|
|
#end raw
|
|
//-->
|
|
</script>
|
|
|
|
<style>
|
|
#set theme_suffix = ('', '-dark')['dark' == $getVar('sbThemeName', THEME_NAME)]
|
|
.bfr{position:absolute;left:-999px;top:-999px}.bfr img{width:16px;height:16px}.spinner{display:inline-block;width:16px;height:16px;background:url(${sg_root}/images/loading16${theme_suffix}.gif) no-repeat 0 0}
|
|
</style>
|
|
<div class="bfr"><img src="$sg_root/images/loading16${theme_suffix}.gif" /></div>
|
|
|
|
#if $varExists('header')
|
|
#set $heading = ('header', $header)
|
|
#else
|
|
#set $heading = ('title', $title)
|
|
#end if
|
|
<h1 style="margin-bottom:0" class="grey-text #echo '%s">%s' % $heading#</h1>
|
|
|
|
#if $all_shows or ($kwargs and $kwargs.get('show_header'))
|
|
<div class="pull-right" style="margin-top:-35px">
|
|
<select id="showsort" class="form-control form-control-inline input-sm">
|
|
#set $num_all = len($all_shows)
|
|
#set $selected = ' class="selected" selected="selected"'
|
|
<optgroup label="View">
|
|
<option value="*"#if '*' in $saved_showsort_view#$selected>> #else#>#end if#All (#echo ('', '%s/' % ($num_all - $num_hidden))[0 < $num_hidden]#$num_all)</option>
|
|
<option value=".notinlibrary"#if '.notinlibrary' in $saved_showsort_view#$selected>> #else#>#end if#Not In Library (#echo $num_all - $num_inlibrary#)</option>
|
|
<option value=".inlibrary"#if '.inlibrary' in $saved_showsort_view#$selected>> #else#>#end if#In Library ($num_inlibrary)</option>
|
|
#if 'Ani' not in $browse_type
|
|
<option value=".hide"#if '.hide' in $saved_showsort_view#$selected>> #else#>#end if#Hidden ($num_hidden)</option>
|
|
#end if
|
|
</optgroup>
|
|
<optgroup label="Sort order">
|
|
<option value="asc"#if not $is_showsort_desc#$selected>> #else#>#end if#Asc</option>
|
|
<option value="desc"#if $is_showsort_desc#$selected>> #else#>#end if#Desc</option>
|
|
</optgroup>
|
|
<optgroup label="Sort by">
|
|
<option value="by_name"#if 'by_name' in $saved_showsort_sortby and not $reset_showsort_sortby#$selected>> #else#>#end if#Name</option>
|
|
## omit for TVMaze as original order == First Aired
|
|
#if 'TVmaze' not in $browse_type
|
|
<option value="by_order"#if 'by_order' in $saved_showsort_sortby or $reset_showsort_sortby#$selected>> #else#>#end if#Original</option>
|
|
#end if
|
|
<option value="by_premiered"#if 'by_premiered' in $saved_showsort_sortby and not $reset_showsort_sortby#$selected>> #else#>#end if#First aired</option>
|
|
#if $use_returning
|
|
<option value="by_returning"#if 'by_returning' in $saved_showsort_sortby and not $reset_showsort_sortby#$selected>> #else#>#end if#Returning</option>
|
|
#end if
|
|
#if $use_votes
|
|
<option value="by_votes"#if 'by_votes' in $saved_showsort_sortby#$selected>> #else#>#end if#$term_vote</option>
|
|
#end if
|
|
#if $use_ratings
|
|
<option value="by_rating"#if 'by_rating' in $saved_showsort_sortby#$selected>> #else#>#end if#% Rating</option>
|
|
#end if
|
|
#if $use_ratings and $use_votes
|
|
<option value="by_rating_votes"#if 'by_rating_votes' in $saved_showsort_sortby#$selected>> #else#>#end if#% Rating > Votes</option>
|
|
#end if
|
|
</optgroup>
|
|
</select>
|
|
|
|
#if 'Ani' not in $browse_type and $use_filter
|
|
<select id="showfilter" class="form-control form-control-inline input-sm">
|
|
#set $selected = ' class="selected" selected="selected"'
|
|
#if 'Trakt' == $browse_type
|
|
<optgroup label="Trakt">
|
|
<option value="trakt_anticipated"#echo ('', selected)['anticipated' == $mode]#>Anticipating</option>
|
|
<option value="trakt_newseasons"#echo ('', selected)['returning' == $mode]#>New Seasons</option>
|
|
<option value="trakt_newshows"#echo ('', selected)['newshows' == $mode]#>New Shows</option>
|
|
<option value="trakt_popular"#echo ('', selected)['popular' == $mode]#>Popular</option>
|
|
<option value="trakt_trending"#echo ('', selected)['trending' == $mode]#>Trending</option>
|
|
</optgroup>
|
|
<optgroup label="Trakt last month">
|
|
<option value="trakt_watched"#echo ('', selected)['watched' == $mode]#>Most Watched</option>
|
|
<option value="trakt_played"#echo ('', selected)['played' == $mode]#>Most Played</option>
|
|
<option value="trakt_collected"#echo ('', selected)['collected' == $mode]#>Most Collected</option>
|
|
</optgroup>
|
|
<optgroup label="Trakt last 12 months">
|
|
<option value="trakt_watched?period=year"#echo ('', selected)['watched-year' == $mode]#>Most Watched</option>
|
|
<option value="trakt_played?period=year"#echo ('', selected)['played-year' == $mode]#>Most Played</option>
|
|
<option value="trakt_collected?period=year"#echo ('', selected)['collected-year' == $mode]#>Most Collected</option>
|
|
</optgroup>
|
|
#if any($sg_var('TRAKT_ACCOUNTS', []))
|
|
<optgroup label="Trakt recommended">
|
|
#for $account in $sg_var('TRAKT_ACCOUNTS')
|
|
#if $sg_var('TRAKT_ACCOUNTS').get($account).active and $sg_var('TRAKT_ACCOUNTS').get($account).name
|
|
<option value="trakt_recommended?account=$account"#echo ('', selected)[('recommended-%s' % $account) == $mode]#>for $sg_var('TRAKT_ACCOUNTS').get($account).name</option>
|
|
#end if
|
|
#end for
|
|
#else
|
|
<optgroup label="To get recommended">
|
|
<option value="trakt_recommended?action=add">Enable Trakt here</option>
|
|
#end if
|
|
</optgroup>
|
|
#if any($sg_var('TRAKT_ACCOUNTS', []))
|
|
<optgroup label="Trakt watchlisted">
|
|
#for $account in $sg_var('TRAKT_ACCOUNTS')
|
|
#if $sg_var('TRAKT_ACCOUNTS').get($account).active and $sg_var('TRAKT_ACCOUNTS').get($account).name
|
|
<option value="trakt_watchlist?account=$account"#echo ('', selected)[('watchlist-%s' % $account) == $mode]#>for $sg_var('TRAKT_ACCOUNTS').get($account).name</option>
|
|
#end if
|
|
#end for
|
|
#else
|
|
<optgroup label="To get watchlisted">
|
|
<option value="trakt_watchlist?action=add">Enable Trakt here</option>
|
|
#end if
|
|
</optgroup>
|
|
#elif 'IMDb' == $browse_type
|
|
#set $periods = $kwargs and $kwargs.get('periods')
|
|
#if $periods
|
|
<optgroup label="IMDb Popular">
|
|
#for $i, $p in enumerate($periods)
|
|
#set $period='%s,%s' % ($p[0], $p[1])
|
|
<option value="popular_imdb?period=$period"#echo ('', selected)[('popular-%s' % $period) in $mode]#>#echo '%s - %s' % (($p[1], 'Current')[not $i], $p[0])#</option>
|
|
#end for
|
|
<option value="more_imdb"#echo ('', selected + ' disabled')[mode.endswith('more')]#>... list more</option>
|
|
</optgroup>
|
|
#end if
|
|
#if not hasattr($sickgear, 'IMDB_ACCOUNTS')#<optgroup label="Restart SickGear to reveal"><option>new options after restart</option></optgroup>#else#
|
|
<optgroup label="IMDb Watchlists">
|
|
#if any($sg_var('IMDB_ACCOUNTS', []))
|
|
#for $i, $v in $enumerate($sg_var('IMDB_ACCOUNTS'))
|
|
#if not $i % 2
|
|
#set $id = $v
|
|
#elif not $v.startswith('(Off) ')
|
|
<option value="watchlist-imdb?account=$id"#echo ('', selected)[('watchlist-%s' % $id) == $mode]#>#echo '%s%s' % ($v, ('\'s', '')['your' == $v.replace('(Off) ', '').lower()])# list</option>
|
|
#end if
|
|
#end for
|
|
#end if
|
|
<option value="watchlist-imdb?action=add"><< Add lists >></option>
|
|
</optgroup>
|
|
#end if
|
|
#elif 'Metacritic' == $browse_type
|
|
<optgroup label="Metacritic">
|
|
<option value="mc_newseries"#echo ('', selected)['newseries' == $mode]#>New seasons</option>
|
|
<option value="mc_90days"#echo ('', selected)['90days' == $mode]#>Last 90 days</option>
|
|
<option value="mc_year"#echo ('', selected)['year' == $mode]#>By year</option>
|
|
<option value="mc_discussed"#echo ('', selected)['discussed' == $mode]#>Most discussed</option>
|
|
<option value="mc_shared"#echo ('', selected)['shared' == $mode]#>Most shared</option>
|
|
#if $kwargs and $kwargs.get('more') and 'newseries' in $mode
|
|
<option value="mc_newseries?more=1"#echo ('', selected + ' disabled')[mode.endswith('more')]#>... list more</option>
|
|
#end if
|
|
</optgroup>
|
|
#elif 'TMDB' == $browse_type
|
|
<optgroup label="TMDB">
|
|
<option value="tmdb_upcoming"#echo ('', selected)['upcoming' == $mode]#>Upcoming</option>
|
|
<option value="tmdb_popular"#echo ('', selected)['popular' == $mode]#>Popular</option>
|
|
<option value="tmdb_toprated"#echo ('', selected)['toprated' == $mode]#>Top rated</option>
|
|
<option value="tmdb_trending_today"#echo ('', selected)['trending_today' == $mode]#>Trending today</option>
|
|
<option value="tmdb_trending_week"#echo ('', selected)['trending_week' == $mode]#>Trending this week</option>
|
|
</optgroup>
|
|
#elif 'TVCalendar' == $browse_type
|
|
<optgroup label="TVCalendar">
|
|
#for $page in $kwargs.get('pages') or []
|
|
<option value="$page[0]"#echo ('', selected)[$mode in $page[0] and ($kwargs and $kwargs.get('page', 'n/a') in $page[0] or $kwargs and not $kwargs.get('page') and 'this' in $page[1])]#>$page[1]</option>
|
|
#end for
|
|
<option value="tvc_latest"#echo ('', selected)['latest' == $mode]#>Latest additions</option>
|
|
</optgroup>
|
|
#elif 'TVmaze' == $browse_type
|
|
<optgroup label="TVmaze">
|
|
<option value="tvm_premieres"#echo ('', selected)['premieres' == $mode]#>Premieres</option>
|
|
<option value="tvm_returning"#echo ('', selected)['returning' == $mode]#>Returning</option>
|
|
</optgroup>
|
|
#elif 'Nextepisode' == $browse_type
|
|
<optgroup label="Nextepisode">
|
|
<option value="ne_newpop"#echo ('', selected)['newpop' == $mode]#>Popular premiered</option>
|
|
<option value="ne_newtop"#echo ('', selected)['newtop' == $mode]#>Top rated premiered</option>
|
|
<option value="ne_upcoming"#echo ('', selected)['upcoming' == $mode]#>Upcoming</option>
|
|
<option value="ne_trending"#echo ('', selected)['trending' == $mode]#>Trending</option>
|
|
<option value="more_ne"#echo ('', selected + ' disabled')[mode.endswith('more')]#>... list more</option>
|
|
</optgroup>
|
|
#end if
|
|
</select>
|
|
#end if
|
|
</div>
|
|
<div class="pull-right" style="clear:right">
|
|
<input id="search_show_name" class="search form-control form-control-inline input-sm input200" type="search" placeholder="Filter Show Name#if $use_network#/Network#end if#">
|
|
<button type="button" class="resetshows btn btn-inline">Reset Filter</button>
|
|
</div>
|
|
<h4 style="float:left;margin:0 0 0 2px">$browse_title</h4>
|
|
#if $kwargs and $kwargs.get('oldest')
|
|
<div class="grey-text" style="clear:left;margin-left:2px;font-size:0.85em">
|
|
First aired from $kwargs['oldest'] until $kwargs['newest']
|
|
</div>
|
|
#end if
|
|
#end if
|
|
|
|
<div id="container">
|
|
#if $all_shows
|
|
#set $poster_id = 0
|
|
#for $this_show in $all_shows
|
|
#set $poster_id += 1
|
|
|
|
#set $title_html = $this_show['title'].replace('"', '"').replace("'", ''')
|
|
#if 'returning' == $mode
|
|
#set $overview = '%s: %s' % (
|
|
'Season %s' % $this_show['episode_season'],
|
|
$this_show['episode_overview'] or $this_show['overview'])
|
|
#else
|
|
#set $overview = $this_show['overview']
|
|
#end if
|
|
|
|
#set $show_id = $this_show.get('show_id')
|
|
#set $known = ('not', '')[bool($this_show.get('indb'))]
|
|
#set $hide = ('', '%shide ' % ('', 'to-')['.hide' in $saved_showsort_view])[bool($this_show.get('hide'))]
|
|
#if $use_ratings:
|
|
#set $data_rating = $try_float($this_show['rating'])
|
|
#end if
|
|
|
|
<div class="show-card ${hide}${known}inlibrary" data-name="#echo re.sub(r'([\'\"])', r'', $this_show['title'])#" data_id="$show_id"#if $use_ratings# data-rating="$data_rating"#end if##if $use_votes# data-votes="$this_show['votes']"#end if# data-premiered="$this_show['ord_premiered']"#if $use_returning# data-returning="$this_show['ord_returning']"#end if# data-order="$this_show['order']"#if $use_network# data-network="$this_show['network']"#end if#>
|
|
<div class="show-card-inner">
|
|
<div class="browse-image">
|
|
<a class="browse-image" href="<%= anon_url(this_show['url_src_db']) %>" target="_blank"
|
|
title="<span style='color: rgb(66, 139, 202)'>$re.sub(r'(?m)\s+\((?:19|20)\d\d\)\s*$', '', $title_html)</span>
|
|
|
|
#if $this_show['genres']#<br><div style='font-weight:bold'>(<em>$this_show['genres']</em>)</div>#end if#
|
|
#if $kwargs and $use_returning#<span style='display:block;clear:both;font-weight:bold;font-size:0.9em;color:#888'><em>Season $this_show['episode_season'] return#echo ('s', 'ed')[$this_show['return_past']]# $this_show['str_returning']</em></span>#end if#
|
|
#if $this_show.get('country') or $this_show.get('language')
|
|
<p style='line-height:15px;margin-bottom:2px'>
|
|
#if $this_show.get('country')
|
|
<span style='font-size:0.9em;color:#888'><em>Country:#if not $this_show.get('country_img')# $this_show.get('country').upper()#else#<img style='margin:0 0 2px 4px;width:16px;height:11px;vertical-align:middle' title='${this_show['country']}' src='$sbRoot/images/flags/${$this_show['country'].lower()}.png' width='16' height='11'>#end if#</em></span>
|
|
#end if
|
|
#if $this_show.get('language')
|
|
<span style='font-size:0.9em;color:#888#if $this_show.get('country')#;padding-left:6px#end if#'><em>Language:#if not $this_show.get('language_img')# $this_show.get('language')#else#<img style='margin:0 0 2px 4px;width:16px;height:11px;vertical-align:middle' title='${this_show['language']}' src='$sbRoot/images/flags/${$this_show['language'].lower()}.png' width='16' height='11'>#end if#</em></span>
|
|
#end if
|
|
</p>
|
|
#end if
|
|
<p style='margin:0 0 2px'>#echo re.sub(r'([,\.!][^,\.!]*?)$', '...', re.sub(r'([!\?\.])(?=\w)', r'\1 ', $overview)).replace('.....', '...')#</p>
|
|
<p>#if $this_show['str_premiered']#<span style='font-weight:bold;font-size:0.9em;color:#888'><em>#if 'Trakt' == $browse_type and $kwargs and 'returning' == $mode#Air#else#First air#end if##echo ('s', 'ed')[$this_show['started_past']]#: $this_show['str_premiered']</em></span>#end if#
|
|
#if $this_show.get('ended_str')# - <span style='font-weight:bold;font-size:0.9em;color:#888'><em>Ended: $this_show['ended_str']</em></span>#end if#
|
|
#if $this_show.get('network')#<span style='display:block;clear:both;font-weight:bold;font-size:0.9em;color:#888'><em>On: $this_show['network']</em></span>#end if#
|
|
</p>
|
|
<span style='float:right'>Click for more at <span class='boldest'>$browse_type</span></span>">
|
|
#if 'poster' in $this_show['images']
|
|
#set $image = $this_show['images']['poster']['thumb']
|
|
<img id="poster-$poster_id" alt="" class="browse-image" data-original="#if $image and 'http' != $image[:4]#$sg_root/#end if#$image" />
|
|
<span id="loading-poster-$poster_id" class="lazy-loading-image"><i class="spinner"></i></span>
|
|
#else
|
|
<span> </span>
|
|
#end if
|
|
</a>
|
|
</div>
|
|
|
|
<div class="show-title">
|
|
#echo ((re.sub(r'^((?:A(?!\s+to)n?)|The)\s(\w)', r'<span class="article">\1</span> \2', $this_show['title']), $this_show['title'])[$sg_var('SORT_ARTICLE')], '<span> </span>')['' == $this_show['title']]#
|
|
</div>
|
|
#if 'Ani' not in $browse_type
|
|
<a class="show-toggle-hide" href="$sg_root/add-shows/show-toggle-hide?ids=$show_id" title="#echo ('H', 'Unh')[any($hide)]#ide"><i class="sgicon-delete"></i></a>
|
|
#end if
|
|
<div class="clearfix">
|
|
#if $use_ratings or $use_votes
|
|
<p>#if $use_ratings#<span class="rating">$this_show['rating']#if $re.search(r'^\d+(\.\d+)?$', (str($this_show['rating'])))#%</span>#end if##end if##if $use_votes#<i class="heart icon-glyph"></i><i>$this_show['votes'] $term_vote.lower()</i>#end if#</p>#slurp#
|
|
#end if
|
|
#if 'url_tvdb' in $this_show and $this_show['url_tvdb']
|
|
<a class="service" href="<%= anon_url(this_show['url_tvdb']) %>" onclick="window.open(this.href, '_blank'); return false;"
|
|
title="View <span class='boldest'>tvdb</span> detail for <span style='color: rgb(66, 139, 202)'>$title_html</span>">
|
|
<i><img style="margin-top:5px" alt="tvdb" height="16" width="16" src="$sg_root/images/$sickgear.TVInfoAPI($sickgear.indexers.indexer_config.TVINFO_TVDB).config['icon']" /></i></a>
|
|
#end if
|
|
|
|
<div class="browse-add-show-holder">
|
|
#if bool($this_show.get('indb'))
|
|
<p style="line-height:1.5;padding:2px 5px 3px" title="#echo '%s added' % $this_show.get('indb')#">In library</p>
|
|
#else
|
|
<a href="$sg_root/add-shows/info-${browse_type.lower()}?ids=${this_show['show_id']}&show_name=${quote($this_show['title'].encode("utf-8"))}" class="btn btn-xs">Add Show</a>
|
|
#end if
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="ui-progressbar ui-widget ui-widget-content ui-corner-all">
|
|
#set $state = 'progress-%s0" title="%s"' % (('2', 'Upcoming'), ('8', 'Started'))[$this_show['started_past']]
|
|
<div style="width:102%" class="ui-progressbar-value ui-widget-header ui-corner-left ui-corner-right $state></div>
|
|
</div>
|
|
</div>
|
|
#end for
|
|
</div>
|
|
#if $kwargs and $kwargs.get('footnote')
|
|
<div style="clear:both">
|
|
$kwargs['footnote']
|
|
</div>
|
|
#end if
|
|
#else
|
|
<div class="show-card" style="width:100%; margin-top:20px; padding:20px">
|
|
<p class="red-text">
|
|
#if $kwargs and $kwargs.get('error_msg')
|
|
$kwargs['error_msg']
|
|
#else
|
|
$browse_type did not return results, this can happen from time to time.
|
|
<br><br>This view should auto refresh every 10 mins.
|
|
|
|
<script type="text/javascript" charset="utf-8">
|
|
<!--
|
|
window.setInterval('location.reload(true)', 600000); // Refresh every 10 minutes
|
|
//-->
|
|
</script>
|
|
#end if
|
|
</p>
|
|
</div>
|
|
</div>
|
|
#end if
|
|
|
|
<script type="text/javascript" src="$sg_root/js/lazyload/lazyload.min.js?v=$sbPID"></script>
|
|
<script type="text/javascript" src="$sg_root/js/inc_bottom.js?v=$sbPID"></script>
|
|
#if 'library' in $saved_showsort_view or 'hide' in $saved_showsort_view
|
|
<script type="text/javascript" charset="utf-8">
|
|
<!--
|
|
\$(document).ready(function(){
|
|
#if 'library' in $saved_showsort_view
|
|
// restore inlibrary/notinlibrary
|
|
\$('.show-card').filter(\$('.to-hide')).removeClass('to-hide').addClass('hide');
|
|
var filter = '#echo '.%sinlibrary' % ('', 'not')['not' in $saved_showsort_view]#';
|
|
#else
|
|
// restore hidden
|
|
\$('.show-card').filter(\$('.hide')).removeClass('hide').addClass('to-hide');
|
|
var filter = '.hide';
|
|
#end if
|
|
#raw
|
|
var dev = !1
|
|
$.iso.one('revealComplete', function(){llUpdate(); dev && console.log('revealed')});
|
|
$.iso.one('layoutComplete', function(){llUpdate(); dev && console.log('layout')});
|
|
$.iso.one('arrangeComplete', function(){llUpdate(); dev && console.log('arranged')});
|
|
$.iso.one('hideComplete', function(){llUpdate(); dev && console.log('hidden')});
|
|
$.iso.isotope({ filter: filter });
|
|
$.iso.isotope('layout');
|
|
#end raw
|
|
});
|
|
//-->
|
|
</script>
|
|
#end if
|
|
#include $os.path.join($sg_str('PROG_DIR'), 'gui/slick/interfaces/default/inc_bottom.tmpl')
|