mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-07 03:48:02 -05:00
Fixed small cosmetic bug with trakt trending shows page.
KAT torrent provider now gets and stores size and publishing date info.
This commit is contained in:
parent
8066983384
commit
a14969f4bf
@ -121,7 +121,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<div id="container"></div>
|
<div id="trendingShows"></div>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
@ -1,18 +1,66 @@
|
|||||||
#import sickbeard
|
<script type="text/javascript" charset="utf-8">
|
||||||
#import datetime
|
<!--
|
||||||
#import re
|
|
||||||
#from sickbeard.common import *
|
|
||||||
#from sickbeard import sbdatetime
|
|
||||||
#from sickbeard.helpers import anon_url
|
|
||||||
|
|
||||||
#set global $title='Trending Shows'
|
\$(document).ready(function(){
|
||||||
#set global $header='Trending Shows'
|
// initialise combos for dirty page refreshes
|
||||||
|
\$('#showsort').val('original');
|
||||||
|
\$('#showsortdirection').val('asc');
|
||||||
|
|
||||||
#set global $sbPath='..'
|
var \$container = [\$('#container')];
|
||||||
|
jQuery.each(\$container, function (j) {
|
||||||
|
this.isotope({
|
||||||
|
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',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
#set global $topmenu='comingEpisodes'
|
\$('#showsort').on( 'change', function() {
|
||||||
#import os.path
|
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)});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div id="container">
|
||||||
#if not $trending_shows
|
#if not $trending_shows
|
||||||
<div class="trakt_show" style="width:100%; margin-top:20px">
|
<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.
|
<p class="red-text">Trakt API did not return any results, please check your config.
|
||||||
@ -42,4 +90,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
#end for
|
#end for
|
||||||
#end if
|
#end if
|
||||||
|
</div>
|
@ -1,8 +1,8 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
function loadContent() {
|
function loadContent() {
|
||||||
$('#container').html('<img id="searchingAnim" src="' + sbRoot + '/images/loading32' + themeSpinner + '.gif" height="32" width="32" /> loading trending shows...');
|
$('#trendingShows').html('<img id="searchingAnim" src="' + sbRoot + '/images/loading32' + themeSpinner + '.gif" height="32" width="32" /> loading trending shows...');
|
||||||
$.get(sbRoot+'/home/addShows/getTrendingShows/', function(data) {
|
$.get(sbRoot+'/home/addShows/getTrendingShows/', function(data) {
|
||||||
$('#container').html(data);
|
$('#trendingShows').html(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -228,6 +228,10 @@ class BitSoupProvider(generic.TorrentProvider):
|
|||||||
|
|
||||||
title, url, id, seeders, leechers = item
|
title, url, id, seeders, leechers = item
|
||||||
|
|
||||||
|
if title:
|
||||||
|
title = u'' + title
|
||||||
|
title = title.replace(' ', '.')
|
||||||
|
|
||||||
if url:
|
if url:
|
||||||
url = str(url).replace('&', '&')
|
url = str(url).replace('&', '&')
|
||||||
|
|
||||||
|
@ -261,6 +261,10 @@ class FreshOnTVProvider(generic.TorrentProvider):
|
|||||||
|
|
||||||
title, url, id, seeders, leechers = item
|
title, url, id, seeders, leechers = item
|
||||||
|
|
||||||
|
if title:
|
||||||
|
title = u'' + title
|
||||||
|
title = title.replace(' ', '.')
|
||||||
|
|
||||||
if url:
|
if url:
|
||||||
url = str(url).replace('&', '&')
|
url = str(url).replace('&', '&')
|
||||||
|
|
||||||
|
@ -62,7 +62,6 @@ class KATProvider(generic.TorrentProvider):
|
|||||||
self.cache = KATCache(self)
|
self.cache = KATCache(self)
|
||||||
|
|
||||||
self.urls = ['http://kickass.so/', 'http://katproxy.com/', 'http://www.kickmirror.com/']
|
self.urls = ['http://kickass.so/', 'http://katproxy.com/', 'http://www.kickmirror.com/']
|
||||||
self.url = 'https://kickass.so/'
|
|
||||||
|
|
||||||
def isEnabled(self):
|
def isEnabled(self):
|
||||||
return self.enabled
|
return self.enabled
|
||||||
@ -233,8 +232,7 @@ class KATProvider(generic.TorrentProvider):
|
|||||||
logger.log(u"Search string: " + searchURL, logger.DEBUG)
|
logger.log(u"Search string: " + searchURL, logger.DEBUG)
|
||||||
|
|
||||||
entries = self.cache.getRSSFeed(url, items=['entries', 'feed'])['entries']
|
entries = self.cache.getRSSFeed(url, items=['entries', 'feed'])['entries']
|
||||||
if entries:
|
if entries and len(entries) > 0:
|
||||||
self.url = url
|
|
||||||
break
|
break
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -268,7 +266,21 @@ class KATProvider(generic.TorrentProvider):
|
|||||||
if not title or not url:
|
if not title or not url:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
item = title, url, id, seeders, leechers
|
try:
|
||||||
|
pubdate = datetime.datetime(*item['published_parsed'][0:6])
|
||||||
|
except AttributeError:
|
||||||
|
try:
|
||||||
|
pubdate = datetime.datetime(*item['updated_parsed'][0:6])
|
||||||
|
except AttributeError:
|
||||||
|
try:
|
||||||
|
pubdate = datetime.datetime(*item['created_parsed'][0:6])
|
||||||
|
except AttributeError:
|
||||||
|
try:
|
||||||
|
pubdate = datetime.datetime(*item['date'][0:6])
|
||||||
|
except AttributeError:
|
||||||
|
pubdate = datetime.datetime.today()
|
||||||
|
|
||||||
|
item = title, url, id, seeders, leechers, size, pubdate
|
||||||
|
|
||||||
items[mode].append(item)
|
items[mode].append(item)
|
||||||
|
|
||||||
@ -285,7 +297,7 @@ class KATProvider(generic.TorrentProvider):
|
|||||||
|
|
||||||
def _get_title_and_url(self, item):
|
def _get_title_and_url(self, item):
|
||||||
|
|
||||||
title, url, id, seeders, leechers = item
|
title, url, id, seeders, leechers, size, pubdate = item
|
||||||
|
|
||||||
if title:
|
if title:
|
||||||
title = u'' + title
|
title = u'' + title
|
||||||
@ -321,7 +333,9 @@ class KATProvider(generic.TorrentProvider):
|
|||||||
|
|
||||||
for item in self._doSearch(searchString[0]):
|
for item in self._doSearch(searchString[0]):
|
||||||
title, url = self._get_title_and_url(item)
|
title, url = self._get_title_and_url(item)
|
||||||
results.append(classes.Proper(title, url, datetime.datetime.today(), self.show))
|
pubdate = item[6]
|
||||||
|
|
||||||
|
results.append(classes.Proper(title, url, pubdate, self.show))
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
@ -334,7 +348,7 @@ class KATCache(tvcache.TVCache):
|
|||||||
|
|
||||||
tvcache.TVCache.__init__(self, provider)
|
tvcache.TVCache.__init__(self, provider)
|
||||||
|
|
||||||
# only poll ThePirateBay every 10 minutes max
|
# only poll KickAss every 10 minutes max
|
||||||
self.minTime = 20
|
self.minTime = 20
|
||||||
|
|
||||||
def _getRSSData(self):
|
def _getRSSData(self):
|
||||||
@ -345,7 +359,7 @@ class KATCache(tvcache.TVCache):
|
|||||||
logger.log(u"KAT cache update URL: " + searchURL, logger.DEBUG)
|
logger.log(u"KAT cache update URL: " + searchURL, logger.DEBUG)
|
||||||
|
|
||||||
data = self.getRSSFeed(url, items=['entries', 'feed'])['entries']
|
data = self.getRSSFeed(url, items=['entries', 'feed'])['entries']
|
||||||
if data:
|
if data and len(data) > 0:
|
||||||
break
|
break
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
Loading…
Reference in New Issue
Block a user