1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Updated KAT provider urls.

KAT Provider now uses feedcache to get its results via rss feeds.

Fixed issues with Trakt.TV notifications and adding of trending shows

Improved Trakt trending shows page, now shows progress animation well it waits to load shows list.
This commit is contained in:
echel0n 2014-12-11 12:46:01 -08:00
parent 02a9148025
commit 8066983384
4 changed files with 77 additions and 50 deletions

View File

@ -14,6 +14,7 @@
#import os.path #import os.path
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_top.tmpl') #include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_top.tmpl')
<script type="text/javascript" src="$sbRoot/js/addTrendingShow.js?$sbPID"></script>
<script type="text/javascript" src="$sbRoot/js/rootDirs.js?$sbPID"></script> <script type="text/javascript" src="$sbRoot/js/rootDirs.js?$sbPID"></script>
<script type="text/javascript" src="$sbRoot/js/plotTooltip.js?$sbPID"></script> <script type="text/javascript" src="$sbRoot/js/plotTooltip.js?$sbPID"></script>
@ -90,7 +91,6 @@
<h1 class="title">$title</h1> <h1 class="title">$title</h1>
#end if #end if
#if $trending_shows
<div id="tabs"> <div id="tabs">
<ul> <ul>
<li><a href="#tabs-1">Manage Directories</a></li> <li><a href="#tabs-1">Manage Directories</a></li>
@ -119,46 +119,10 @@
<option value="desc">Desc</option> <option value="desc">Desc</option>
</select> </select>
</div> </div>
#end if
<div id="container"> <br />
<div id="container"></div>
#if None is $trending_shows <br />
<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
#for $cur_show in $trending_shows:
#if not 'ExistsInLibrary' in $cur_show['tvdb_id']:
#set $image = re.sub(r'(?im)(.*)(\..*?)$', r'\1-300\2', $cur_show['images']['poster'], 0)
<div class="trakt_show" data-name="$cur_show['title']" data-rating="$cur_show['ratings']['percentage']" data-votes="$cur_show['ratings']['votes']">
<div class="traktContainer">
<div class="trakt-image">
<a class="trakt-image" href="<%= anon_url(cur_show['url']) %>" target="_blank"><img alt="" class="trakt-image" src="${image}" /></a>
</div>
<div class="show-title">
<%= (cur_show['title'], '<span>&nbsp;</span>')[ '' == cur_show['title']] %>
</div>
<div class="clearfix">
<p>$cur_show['ratings']['percentage']% <img src="$sbRoot/images/heart.png"></p>
<i>$cur_show['ratings']['votes'] votes</i>
<div class="traktShowTitleIcons">
<a href="$sbRoot/home/addShows/addTraktShow?indexer_id=${cur_show['tvdb_id']}&amp;showName=${cur_show['title']}" class="btn btn-xs">Add Show</a>
</div>
</div>
</div>
</div>
#end if
#end for
#end if
</div>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
<!-- <!--

View File

@ -0,0 +1,45 @@
#import sickbeard
#import datetime
#import re
#from sickbeard.common import *
#from sickbeard import sbdatetime
#from sickbeard.helpers import anon_url
#set global $title='Trending Shows'
#set global $header='Trending Shows'
#set global $sbPath='..'
#set global $topmenu='comingEpisodes'
#import os.path
#if not $trending_shows
<div class="trakt_show" style="width:100%; margin-top:20px">
<p class="red-text">Trakt API did not return any results, please check your config.
</div>
#else
#for $cur_show in $trending_shows:
#set $image = re.sub(r'(?im)(.*)(\..*?)$', r'\1-300\2', $cur_show['images']['poster'], 0)
<div class="trakt_show" data-name="$cur_show['title']" data-rating="$cur_show['ratings']['percentage']" data-votes="$cur_show['ratings']['votes']">
<div class="traktContainer">
<div class="trakt-image">
<a class="trakt-image" href="<%= anon_url(cur_show['url']) %>" target="_blank"><img alt="" class="trakt-image" src="${image}" /></a>
</div>
<div class="show-title">
<%= (cur_show['title'], '<span>&nbsp;</span>')[ '' == cur_show['title']] %>
</div>
<div class="clearfix">
<p>$cur_show['ratings']['percentage']% <img src="$sbRoot/images/heart.png"></p>
<i>$cur_show['ratings']['votes'] votes</i>
<div class="traktShowTitleIcons">
<a href="$sbRoot/home/addShows/addTraktShow?indexer_id=${cur_show['tvdb_id'] or cur_show['tvrage_id']}&amp;showName=${cur_show['title']}" class="btn btn-xs">Add Show</a>
</div>
</div>
</div>
</div>
#end for
#end if

View File

@ -0,0 +1,11 @@
$(document).ready(function() {
function loadContent() {
$('#container').html('<img id="searchingAnim" src="' + sbRoot + '/images/loading32' + themeSpinner + '.gif" height="32" width="32" /> loading trending shows...');
$.get(sbRoot+'/home/addShows/getTrendingShows/', function(data) {
$('#container').html(data);
});
}
loadContent();
});

View File

@ -2234,21 +2234,28 @@ class HomeAddShows(Home):
t = PageTemplate(rh=self, file="home_trendingShows.tmpl") t = PageTemplate(rh=self, file="home_trendingShows.tmpl")
t.submenu = self.HomeMenu() t.submenu = self.HomeMenu()
return t
def getTrendingShows(self, *args, **kwargs):
"""
Display the new show page which collects a tvdb id, folder, and extra options and
posts them to addNewShow
"""
t = PageTemplate(rh=self, file="trendingShows.tmpl")
t.submenu = self.HomeMenu()
t.trending_shows = [] t.trending_shows = []
trakt_api = TraktAPI(sickbeard.TRAKT_API, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD) trakt_api = TraktAPI(sickbeard.TRAKT_API, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD)
try: try:
trending_shows = trakt_api.traktRequest("shows/trending.json/%APIKEY%") for show in trakt_api.traktRequest("shows/trending.json/%APIKEY%") or []:
try:
if trending_shows: if not helpers.findCertainShow(sickbeard.showList,
for show in trending_shows: [int(show['tvdb_id']), int(show['tvrage_id'])]):
try: t.trending_shows += [show]
if not helpers.findCertainShow(sickbeard.showList, except exceptions.MultipleShowObjectsException:
[int(show['tvdb_id']), int(show['tvrage_id'])]): continue
t.trending_shows += [show]
except exceptions.MultipleShowObjectsException:
continue
except (traktException, traktAuthException, traktServerBusy) as e: except (traktException, traktAuthException, traktServerBusy) as e:
logger.log(u"Could not connect to Trakt service: %s" % ex(e), logger.WARNING) logger.log(u"Could not connect to Trakt service: %s" % ex(e), logger.WARNING)