mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-05 10:58:01 -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>
|
||||
|
||||
<br />
|
||||
<div id="container"></div>
|
||||
<div id="trendingShows"></div>
|
||||
<br />
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
|
@ -1,18 +1,66 @@
|
||||
#import sickbeard
|
||||
#import datetime
|
||||
#import re
|
||||
#from sickbeard.common import *
|
||||
#from sickbeard import sbdatetime
|
||||
#from sickbeard.helpers import anon_url
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
<!--
|
||||
|
||||
#set global $title='Trending Shows'
|
||||
#set global $header='Trending Shows'
|
||||
\$(document).ready(function(){
|
||||
// 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'
|
||||
#import os.path
|
||||
\$('#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)});
|
||||
});
|
||||
});
|
||||
|
||||
//-->
|
||||
</script>
|
||||
|
||||
<div id="container">
|
||||
#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.
|
||||
@ -42,4 +90,5 @@
|
||||
</div>
|
||||
</div>
|
||||
#end for
|
||||
#end if
|
||||
#end if
|
||||
</div>
|
@ -1,8 +1,8 @@
|
||||
$(document).ready(function() {
|
||||
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) {
|
||||
$('#container').html(data);
|
||||
$('#trendingShows').html(data);
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -228,6 +228,10 @@ class BitSoupProvider(generic.TorrentProvider):
|
||||
|
||||
title, url, id, seeders, leechers = item
|
||||
|
||||
if title:
|
||||
title = u'' + title
|
||||
title = title.replace(' ', '.')
|
||||
|
||||
if url:
|
||||
url = str(url).replace('&', '&')
|
||||
|
||||
|
@ -261,6 +261,10 @@ class FreshOnTVProvider(generic.TorrentProvider):
|
||||
|
||||
title, url, id, seeders, leechers = item
|
||||
|
||||
if title:
|
||||
title = u'' + title
|
||||
title = title.replace(' ', '.')
|
||||
|
||||
if url:
|
||||
url = str(url).replace('&', '&')
|
||||
|
||||
|
@ -62,7 +62,6 @@ class KATProvider(generic.TorrentProvider):
|
||||
self.cache = KATCache(self)
|
||||
|
||||
self.urls = ['http://kickass.so/', 'http://katproxy.com/', 'http://www.kickmirror.com/']
|
||||
self.url = 'https://kickass.so/'
|
||||
|
||||
def isEnabled(self):
|
||||
return self.enabled
|
||||
@ -233,8 +232,7 @@ class KATProvider(generic.TorrentProvider):
|
||||
logger.log(u"Search string: " + searchURL, logger.DEBUG)
|
||||
|
||||
entries = self.cache.getRSSFeed(url, items=['entries', 'feed'])['entries']
|
||||
if entries:
|
||||
self.url = url
|
||||
if entries and len(entries) > 0:
|
||||
break
|
||||
|
||||
try:
|
||||
@ -268,7 +266,21 @@ class KATProvider(generic.TorrentProvider):
|
||||
if not title or not url:
|
||||
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)
|
||||
|
||||
@ -285,7 +297,7 @@ class KATProvider(generic.TorrentProvider):
|
||||
|
||||
def _get_title_and_url(self, item):
|
||||
|
||||
title, url, id, seeders, leechers = item
|
||||
title, url, id, seeders, leechers, size, pubdate = item
|
||||
|
||||
if title:
|
||||
title = u'' + title
|
||||
@ -321,7 +333,9 @@ class KATProvider(generic.TorrentProvider):
|
||||
|
||||
for item in self._doSearch(searchString[0]):
|
||||
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
|
||||
|
||||
@ -334,7 +348,7 @@ class KATCache(tvcache.TVCache):
|
||||
|
||||
tvcache.TVCache.__init__(self, provider)
|
||||
|
||||
# only poll ThePirateBay every 10 minutes max
|
||||
# only poll KickAss every 10 minutes max
|
||||
self.minTime = 20
|
||||
|
||||
def _getRSSData(self):
|
||||
@ -345,7 +359,7 @@ class KATCache(tvcache.TVCache):
|
||||
logger.log(u"KAT cache update URL: " + searchURL, logger.DEBUG)
|
||||
|
||||
data = self.getRSSFeed(url, items=['entries', 'feed'])['entries']
|
||||
if data:
|
||||
if data and len(data) > 0:
|
||||
break
|
||||
|
||||
return data
|
||||
|
Loading…
Reference in New Issue
Block a user