Merge branch 'refs/heads/develop'

This commit is contained in:
Ruud
2012-12-22 16:33:47 +01:00
2 changed files with 25 additions and 10 deletions
@@ -90,17 +90,18 @@ var UpdaterBase = new Class({
doUpdate: function(){ doUpdate: function(){
var self = this; var self = this;
App.blockPage('Please wait while CouchPotato is being updated with more awesome stuff.', 'Updating');
Api.request('updater.update', { Api.request('updater.update', {
'onComplete': function(json){ 'onComplete': function(json){
if(json.success){ if(json.success)
self.updating(); self.updating();
} else
App.unBlockPage()
} }
}); });
}, },
updating: function(){ updating: function(){
App.blockPage('Please wait while CouchPotato is being updated with more awesome stuff.', 'Updating');
App.checkAvailable.delay(500, App, [1000, function(){ App.checkAvailable.delay(500, App, [1000, function(){
window.location.reload(); window.location.reload();
}]); }]);
+21 -7
View File
@@ -53,7 +53,7 @@ class Newznab(NZBProvider, RSS):
'r': host['api_key'], 'r': host['api_key'],
'i': 58, 'i': 58,
}) })
url = "%s?%s" % (cleanHost(host['host']) + 'rss', arguments) url = '%s?%s' % (cleanHost(host['host']) + 'rss', arguments)
cache_key = 'newznab.%s.feed.%s' % (host['host'], arguments) cache_key = 'newznab.%s.feed.%s' % (host['host'], arguments)
results = self.createItems(url, cache_key, host, for_feed = True) results = self.createItems(url, cache_key, host, for_feed = True)
@@ -87,7 +87,7 @@ class Newznab(NZBProvider, RSS):
'apikey': host['api_key'], 'apikey': host['api_key'],
'extended': 1 'extended': 1
}) })
url = "%s&%s" % (self.getUrl(host['host'], self.urls['search']), arguments) url = '%s&%s' % (self.getUrl(host['host'], self.urls['search']), arguments)
cache_key = 'newznab.%s.%s.%s' % (host['host'], movie['library']['identifier'], cat_id) cache_key = 'newznab.%s.%s.%s' % (host['host'], movie['library']['identifier'], cat_id)
@@ -111,19 +111,33 @@ class Newznab(NZBProvider, RSS):
results = [] results = []
for nzb in nzbs: for nzb in nzbs:
nzb_id = self.getTextElement(nzb, "guid").split('/')[-1:].pop() date = None
for item in nzb:
if item.attrib.get('name') == 'usenetdate':
date = item.attrib.get('value')
break
if not date:
date = self.getTextElement(nzb, 'pubDate')
nzb_id = self.getTextElement(nzb, 'guid').split('/')[-1:].pop()
name = self.getTextElement(nzb, 'title')
if not name:
continue
new = { new = {
'id': nzb_id, 'id': nzb_id,
'provider': self.getName(), 'provider': self.getName(),
'provider_extra': host['host'], 'provider_extra': host['host'],
'type': 'nzb', 'type': 'nzb',
'name': self.getTextElement(nzb, "title"), 'name': self.getTextElement(nzb, 'title'),
'age': self.calculateAge(int(time.mktime(parse(self.getTextElement(nzb, 'pubDate')).timetuple()))), 'age': self.calculateAge(int(time.mktime(parse(date).timetuple()))),
'size': int(self.getElement(nzb, "enclosure").attrib['length']) / 1024 / 1024, 'size': int(self.getElement(nzb, 'enclosure').attrib['length']) / 1024 / 1024,
'url': (self.getUrl(host['host'], self.urls['download']) % nzb_id) + self.getApiExt(host), 'url': (self.getUrl(host['host'], self.urls['download']) % nzb_id) + self.getApiExt(host),
'download': self.download, 'download': self.download,
'detail_url': '%sdetails/%s' % (cleanHost(host['host']), nzb_id), 'detail_url': '%sdetails/%s' % (cleanHost(host['host']), nzb_id),
'content': self.getTextElement(nzb, "description"), 'content': self.getTextElement(nzb, 'description'),
} }
if not for_feed: if not for_feed: