commit
51d44bfc3e
6 files changed
+27
-32
No files matched your search
@@ -94,6 +94,8 @@ class Provider(Plugin):
|
|||||||
try:
|
try:
|
||||||
data = XMLTree.fromstring(ss(data))
|
data = XMLTree.fromstring(ss(data))
|
||||||
return self.getElements(data, item_path)
|
return self.getElements(data, item_path)
|
||||||
|
except XMLTree.ParseError:
|
||||||
|
log.error('Invalid XML returned, check "%s" manually for issues', url)
|
||||||
except:
|
except:
|
||||||
log.error('Failed to parsing %s: %s', (self.getName(), traceback.format_exc()))
|
log.error('Failed to parsing %s: %s', (self.getName(), traceback.format_exc()))
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
from urlparse import urlparse, parse_qs
|
|
||||||
import time
|
|
||||||
|
|
||||||
from couchpotato.core.event import fireEvent
|
from couchpotato.core.event import fireEvent
|
||||||
from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode
|
from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode
|
||||||
from couchpotato.core.helpers.rss import RSS
|
from couchpotato.core.helpers.rss import RSS
|
||||||
from couchpotato.core.helpers.variable import tryInt
|
from couchpotato.core.helpers.variable import tryInt
|
||||||
from couchpotato.core.logger import CPLog
|
from couchpotato.core.logger import CPLog
|
||||||
from couchpotato.core.media._base.providers.nzb.base import NZBProvider
|
from couchpotato.core.media._base.providers.nzb.base import NZBProvider
|
||||||
from dateutil.parser import parse
|
|
||||||
|
|
||||||
|
|
||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
@@ -16,8 +12,7 @@ log = CPLog(__name__)
|
|||||||
class Base(NZBProvider, RSS):
|
class Base(NZBProvider, RSS):
|
||||||
|
|
||||||
urls = {
|
urls = {
|
||||||
'search': 'https://rss.omgwtfnzbs.org/rss-search.php?%s',
|
'search': 'https://api.omgwtfnzbs.org/json/?%s',
|
||||||
'detail_url': 'https://omgwtfnzbs.org/details.php?id=%s',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
http_time_between_calls = 1 # Seconds
|
http_time_between_calls = 1 # Seconds
|
||||||
@@ -47,22 +42,20 @@ class Base(NZBProvider, RSS):
|
|||||||
'api': self.conf('api_key', default = ''),
|
'api': self.conf('api_key', default = ''),
|
||||||
})
|
})
|
||||||
|
|
||||||
nzbs = self.getRSSData(self.urls['search'] % params)
|
nzbs = self.getJsonData(self.urls['search'] % params)
|
||||||
|
|
||||||
for nzb in nzbs:
|
if isinstance(nzbs, list):
|
||||||
|
for nzb in nzbs:
|
||||||
|
|
||||||
enclosure = self.getElement(nzb, 'enclosure').attrib
|
results.append({
|
||||||
nzb_id = parse_qs(urlparse(self.getTextElement(nzb, 'link')).query).get('id')[0]
|
'id': nzb.get('nzbid'),
|
||||||
|
'name': toUnicode(nzb.get('release')),
|
||||||
results.append({
|
'age': self.calculateAge(tryInt(nzb.get('usenetage'))),
|
||||||
'id': nzb_id,
|
'size': tryInt(nzb.get('sizebytes')) / 1024 / 1024,
|
||||||
'name': toUnicode(self.getTextElement(nzb, 'title')),
|
'url': nzb.get('getnzb'),
|
||||||
'age': self.calculateAge(int(time.mktime(parse(self.getTextElement(nzb, 'pubDate')).timetuple()))),
|
'detail_url': nzb.get('details'),
|
||||||
'size': tryInt(enclosure['length']) / 1024 / 1024,
|
'description': nzb.get('weblink')
|
||||||
'url': enclosure['url'],
|
})
|
||||||
'detail_url': self.urls['detail_url'] % nzb_id,
|
|
||||||
'description': self.getTextElement(nzb, 'description')
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
config = [{
|
config = [{
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class Base(TorrentProvider):
|
|||||||
|
|
||||||
full_id = link['href'].replace('details.php?id=', '')
|
full_id = link['href'].replace('details.php?id=', '')
|
||||||
torrent_id = full_id[:6]
|
torrent_id = full_id[:6]
|
||||||
name = toUnicode(link.contents[0])
|
name = toUnicode(link.contents[0].encode('ISO-8859-1')).strip()
|
||||||
|
|
||||||
results.append({
|
results.append({
|
||||||
'id': torrent_id,
|
'id': torrent_id,
|
||||||
|
|||||||
@@ -44,11 +44,12 @@ var Charts = new Class({
|
|||||||
|
|
||||||
if( Cookie.read('suggestions_charts_menu_selected') === 'charts'){
|
if( Cookie.read('suggestions_charts_menu_selected') === 'charts'){
|
||||||
self.show();
|
self.show();
|
||||||
self.fireEvent.delay(0, self, 'created');
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
self.el.hide();
|
self.el.hide();
|
||||||
|
|
||||||
|
self.fireEvent.delay(0, self, 'created');
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
fill: function(json){
|
fill: function(json){
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ var SuggestList = new Class({
|
|||||||
self.show();
|
self.show();
|
||||||
else
|
else
|
||||||
self.hide();
|
self.hide();
|
||||||
|
|
||||||
self.fireEvent('created');
|
self.fireEvent.delay(0, self, 'created');
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -149,16 +149,15 @@ class CoreNotifier(Notification):
|
|||||||
def notify(self, message = '', data = None, listener = None):
|
def notify(self, message = '', data = None, listener = None):
|
||||||
if not data: data = {}
|
if not data: data = {}
|
||||||
|
|
||||||
|
n = {
|
||||||
|
'_t': 'notification',
|
||||||
|
'time': int(time.time()),
|
||||||
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
db = get_db()
|
db = get_db()
|
||||||
|
|
||||||
data['notification_type'] = listener if listener else 'unknown'
|
n['message'] = toUnicode(message)
|
||||||
|
|
||||||
n = {
|
|
||||||
'_t': 'notification',
|
|
||||||
'time': int(time.time()),
|
|
||||||
'message': toUnicode(message)
|
|
||||||
}
|
|
||||||
|
|
||||||
if data.get('sticky'):
|
if data.get('sticky'):
|
||||||
n['sticky'] = True
|
n['sticky'] = True
|
||||||
@@ -171,7 +170,7 @@ class CoreNotifier(Notification):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
log.error('Failed notify: %s', traceback.format_exc())
|
log.error('Failed notify "%s": %s', (n, traceback.format_exc()))
|
||||||
|
|
||||||
def frontend(self, type = 'notification', data = None, message = None):
|
def frontend(self, type = 'notification', data = None, message = None):
|
||||||
if not data: data = {}
|
if not data: data = {}
|
||||||
|
|||||||
Reference in new issue
Block a user