2014-07-01 04:49:12 -04:00
|
|
|
#import sickbeard
|
|
|
|
#import datetime
|
|
|
|
#import re
|
|
|
|
#from sickbeard.common import *
|
|
|
|
#from sickbeard import sbdatetime
|
2014-11-08 21:49:38 -05:00
|
|
|
#from sickbeard.helpers import anon_url
|
2014-07-01 04:49:12 -04:00
|
|
|
|
2014-11-05 23:55:43 -05:00
|
|
|
#set global $title='Trending Shows'
|
|
|
|
#set global $header='Trending Shows'
|
2014-07-01 04:49:12 -04:00
|
|
|
|
2014-11-05 23:55:43 -05:00
|
|
|
#set global $sbPath='..'
|
2014-07-01 04:49:12 -04:00
|
|
|
|
2014-11-05 23:55:43 -05:00
|
|
|
#set global $topmenu='comingEpisodes'
|
2014-07-01 04:49:12 -04:00
|
|
|
#import os.path
|
2014-11-05 23:55:43 -05:00
|
|
|
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_top.tmpl')
|
2014-07-01 04:49:12 -04:00
|
|
|
|
2014-11-14 19:35:10 -05:00
|
|
|
<script type="text/javascript" src="$sbRoot/js/rootDirs.js?$sbPID"></script>
|
2014-07-01 04:49:12 -04:00
|
|
|
<script type="text/javascript" src="$sbRoot/js/plotTooltip.js?$sbPID"></script>
|
|
|
|
|
2014-10-21 15:09:01 -04:00
|
|
|
<script type="text/javascript" charset="utf-8">
|
|
|
|
<!--
|
|
|
|
|
2014-11-05 23:55:43 -05:00
|
|
|
\$(document).ready(function(){
|
2014-11-14 19:35:10 -05:00
|
|
|
\$( "#tabs" ).tabs({
|
|
|
|
collapsible: true,
|
|
|
|
selected: #if $sickbeard.ROOT_DIRS then '-1' else '0'#
|
|
|
|
});
|
|
|
|
|
2014-11-05 23:55:43 -05:00
|
|
|
// initialise combos for dirty page refreshes
|
|
|
|
\$('#showsort').val('original');
|
|
|
|
\$('#showsortdirection').val('asc');
|
|
|
|
|
|
|
|
var \$container = [\$('#container')];
|
|
|
|
jQuery.each(\$container, function (j) {
|
2014-10-21 15:09:01 -04:00
|
|
|
this.isotope({
|
2014-11-05 23:55:43 -05:00
|
|
|
itemSelector: '.trakt_show',
|
|
|
|
sortBy: 'original-order',
|
|
|
|
layoutMode: 'fitRows',
|
|
|
|
getSortData: {
|
|
|
|
name: function( itemElem ) {
|
|
|
|
var name = \$( itemElem ).attr('data-name') || '';
|
|
|
|
#if not $sickbeard.SORT_ARTICLE:
|
|
|
|
name = name.replace(/^(The|A|An)\s/i, '');
|
|
|
|
#end if
|
|
|
|
return name.toLowerCase();
|
|
|
|
},
|
|
|
|
rating: '[data-rating] parseInt',
|
|
|
|
votes: '[data-votes] parseInt',
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
\$('#showsort').on( 'change', function() {
|
|
|
|
var sortCriteria;
|
|
|
|
switch (this.value) {
|
|
|
|
case 'original':
|
|
|
|
sortCriteria = 'original-order'
|
|
|
|
break;
|
|
|
|
case 'rating':
|
|
|
|
/* randomise, else the rating_votes can already
|
|
|
|
* have sorted leaving this with nothing to do.
|
|
|
|
*/
|
|
|
|
\$('#container').isotope({sortBy: 'random'});
|
|
|
|
sortCriteria = 'rating';
|
|
|
|
break;
|
|
|
|
case 'rating_votes':
|
|
|
|
sortCriteria = ['rating', 'votes'];
|
|
|
|
break;
|
|
|
|
case 'votes':
|
|
|
|
sortCriteria = 'votes';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sortCriteria = 'name'
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
\$('#container').isotope({sortBy: sortCriteria});
|
|
|
|
});
|
|
|
|
|
|
|
|
\$('#showsortdirection').on( 'change', function() {
|
|
|
|
\$('#container').isotope({sortAscending: ('asc' == this.value)});
|
|
|
|
});
|
2014-10-21 15:09:01 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
//-->
|
|
|
|
</script>
|
|
|
|
|
2014-07-01 04:49:12 -04:00
|
|
|
#if $varExists('header')
|
|
|
|
<h1 class="header">$header</h1>
|
2014-11-05 23:55:43 -05:00
|
|
|
#else
|
2014-07-01 04:49:12 -04:00
|
|
|
<h1 class="title">$title</h1>
|
|
|
|
#end if
|
|
|
|
|
2014-11-05 23:55:43 -05:00
|
|
|
#if $trending_shows
|
2014-11-14 19:35:10 -05:00
|
|
|
<div id="tabs">
|
|
|
|
<ul>
|
|
|
|
<li><a href="#tabs-1">Manage Directories</a></li>
|
|
|
|
<li><a href="#tabs-2">Customize Options</a></li>
|
|
|
|
</ul>
|
|
|
|
<div id="tabs-1" class="existingtabs">
|
|
|
|
#include $os.path.join($sickbeard.PROG_DIR, "gui/slick/interfaces/default/inc_rootDirs.tmpl")
|
|
|
|
</div>
|
|
|
|
<div id="tabs-2" class="existingtabs">
|
|
|
|
#include $os.path.join($sickbeard.PROG_DIR, "gui/slick/interfaces/default/inc_addShowOptions.tmpl")
|
|
|
|
</div>
|
|
|
|
<br>
|
|
|
|
|
2014-11-05 23:55:43 -05:00
|
|
|
<span>Sort By:</span>
|
|
|
|
<select id="showsort" class="form-control form-control-inline input-sm">
|
|
|
|
<option value="name">Name</option>
|
|
|
|
<option value="original" selected="selected">Original</option>
|
|
|
|
<option value="votes">Votes</option>
|
|
|
|
<option value="rating">% Rating</option>
|
|
|
|
<option value="rating_votes">% Rating > Votes</option>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<span style="margin-left:12px">Sort Order:</span>
|
|
|
|
<select id="showsortdirection" class="form-control form-control-inline input-sm">
|
|
|
|
<option value="asc" selected="selected">Asc</option>
|
|
|
|
<option value="desc">Desc</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
#end if
|
|
|
|
|
2014-10-21 15:09:01 -04:00
|
|
|
<div id="container">
|
|
|
|
|
2014-11-05 23:55:43 -05:00
|
|
|
#if None is $trending_shows
|
|
|
|
<div class="trakt_show" style="width:100%; margin-top:20px">
|
|
|
|
<p class="red-text">Trakt API did not return results, this can happen from time to time.
|
|
|
|
<br /><br />This view should auto refresh every 10 mins.</p>
|
|
|
|
</div>
|
|
|
|
#else
|
2014-10-21 15:09:01 -04:00
|
|
|
#for $cur_show in $trending_shows:
|
2014-11-14 19:52:16 -05:00
|
|
|
#if not 'ExistsInLibrary' in $cur_show['tvdb_id']:
|
2014-07-01 04:49:12 -04:00
|
|
|
|
2014-11-13 01:50:55 -05:00
|
|
|
#set $image = re.sub(r'(?im)(.*)(\..*?)$', r'\1-300\2', $cur_show['images']['poster'], 0)
|
2014-11-05 23:55:43 -05:00
|
|
|
|
|
|
|
<div class="trakt_show" data-name="$cur_show['title']" data-rating="$cur_show['ratings']['percentage']" data-votes="$cur_show['ratings']['votes']">
|
2014-10-21 15:09:01 -04:00
|
|
|
<div class="traktContainer">
|
|
|
|
<div class="trakt-image">
|
2014-11-08 21:49:38 -05:00
|
|
|
<a class="trakt-image" href="<%= anon_url(cur_show['url']) %>" target="_blank"><img alt="" class="trakt-image" src="${image}" /></a>
|
2014-10-21 15:09:01 -04:00
|
|
|
</div>
|
2014-11-05 23:55:43 -05:00
|
|
|
|
2014-10-21 15:09:01 -04:00
|
|
|
<div class="show-title">
|
2014-11-05 23:55:43 -05:00
|
|
|
<%= (cur_show['title'], '<span> </span>')[ '' == cur_show['title']] %>
|
2014-10-21 15:09:01 -04:00
|
|
|
</div>
|
2014-11-05 23:55:43 -05:00
|
|
|
|
2014-10-21 15:09:01 -04:00
|
|
|
<div class="clearfix">
|
2014-11-05 23:55:43 -05:00
|
|
|
<p>$cur_show['ratings']['percentage']% <img src="$sbRoot/images/heart.png"></p>
|
|
|
|
<i>$cur_show['ratings']['votes'] votes</i>
|
2014-10-21 15:09:01 -04:00
|
|
|
|
|
|
|
<div class="traktShowTitleIcons">
|
2014-11-05 23:55:43 -05:00
|
|
|
<a href="$sbRoot/home/addTraktShow?indexer_id=${cur_show['tvdb_id']}&showName=${cur_show['title']}" class="btn btn-xs">Add Show</a>
|
2014-10-21 15:09:01 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
2014-09-30 18:20:37 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2014-11-14 19:52:16 -05:00
|
|
|
#end if
|
2014-07-01 04:49:12 -04:00
|
|
|
#end for
|
2014-11-05 23:55:43 -05:00
|
|
|
#end if
|
2014-10-21 15:09:01 -04:00
|
|
|
</div>
|
2014-07-01 04:49:12 -04:00
|
|
|
|
|
|
|
<script type="text/javascript" charset="utf-8">
|
|
|
|
<!--
|
2014-11-05 23:55:43 -05:00
|
|
|
window.setInterval('location.reload(true)', 600000); // Refresh every 10 minutes
|
2014-07-01 04:49:12 -04:00
|
|
|
//-->
|
|
|
|
</script>
|
|
|
|
|
2014-11-05 23:55:43 -05:00
|
|
|
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_bottom.tmpl')
|