diff --git a/couchpotato/core/_base/updater/static/updater.js b/couchpotato/core/_base/updater/static/updater.js index 9f51b0cb..cc17be55 100644 --- a/couchpotato/core/_base/updater/static/updater.js +++ b/couchpotato/core/_base/updater/static/updater.js @@ -90,17 +90,18 @@ var UpdaterBase = new Class({ doUpdate: function(){ var self = this; + App.blockPage('Please wait while CouchPotato is being updated with more awesome stuff.', 'Updating'); Api.request('updater.update', { 'onComplete': function(json){ - if(json.success){ + if(json.success) self.updating(); - } + else + App.unBlockPage() } }); }, updating: function(){ - App.blockPage('Please wait while CouchPotato is being updated with more awesome stuff.', 'Updating'); App.checkAvailable.delay(500, App, [1000, function(){ window.location.reload(); }]); diff --git a/couchpotato/core/providers/nzb/newznab/main.py b/couchpotato/core/providers/nzb/newznab/main.py index fa531058..539d6fa5 100644 --- a/couchpotato/core/providers/nzb/newznab/main.py +++ b/couchpotato/core/providers/nzb/newznab/main.py @@ -53,7 +53,7 @@ class Newznab(NZBProvider, RSS): 'r': host['api_key'], '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) results = self.createItems(url, cache_key, host, for_feed = True) @@ -87,7 +87,7 @@ class Newznab(NZBProvider, RSS): 'apikey': host['api_key'], '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) @@ -111,19 +111,33 @@ class Newznab(NZBProvider, RSS): results = [] 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 = { 'id': nzb_id, 'provider': self.getName(), 'provider_extra': host['host'], 'type': 'nzb', - 'name': self.getTextElement(nzb, "title"), - 'age': self.calculateAge(int(time.mktime(parse(self.getTextElement(nzb, 'pubDate')).timetuple()))), - 'size': int(self.getElement(nzb, "enclosure").attrib['length']) / 1024 / 1024, + 'name': self.getTextElement(nzb, 'title'), + 'age': self.calculateAge(int(time.mktime(parse(date).timetuple()))), + 'size': int(self.getElement(nzb, 'enclosure').attrib['length']) / 1024 / 1024, 'url': (self.getUrl(host['host'], self.urls['download']) % nzb_id) + self.getApiExt(host), 'download': self.download, 'detail_url': '%sdetails/%s' % (cleanHost(host['host']), nzb_id), - 'content': self.getTextElement(nzb, "description"), + 'content': self.getTextElement(nzb, 'description'), } if not for_feed: