NZBx fixes

This commit is contained in:
Ruud committed 2012-12-20 15:19:40 +01:00
1 parent 3c04eed218
commit 031a186d71
1 file changed
+18 -9
+18 -9
View File
@@ -19,13 +19,13 @@ class Nzbx(NZBProvider, RSS):
endpoint = 'https://nzbx.co/api/' endpoint = 'https://nzbx.co/api/'
urls = { urls = {
'search': endpoint + 'search', 'search': 'https://nzbx.co/api/search',
'details': endpoint + 'details?guid=%s', 'details': 'https://nzbx.co/api/details?guid=%s',
'comments': endpoint + 'get-comments?guid=%s', 'comments': 'https://nzbx.co/api/get-comments?guid=%s',
'ratings': endpoint + 'get-votes?guid=%s', 'ratings': 'https://nzbx.co/api/get-votes?guid=%s',
'downloads': endpoint + 'get-downloads-count?guid=%s', 'downloads': 'https://nzbx.co/api/get-downloads-count?guid=%s',
'categories': endpoint + 'categories', 'categories': 'https://nzbx.co/api/categories',
'groups': endpoint + 'groups', 'groups': 'https://nzbx.co/api/groups',
} }
http_time_between_calls = 1 # Seconds http_time_between_calls = 1 # Seconds
@@ -60,16 +60,25 @@ class Nzbx(NZBProvider, RSS):
nzbx_guid = nzb['guid'] nzbx_guid = nzb['guid']
# need to filter by completed def extra_score(item):
score = 0
if item['votes']['upvotes'] > item['votes']['downvotes']:
score += 5
return score
new = { new = {
'guid': nzbx_guid, 'guid': nzbx_guid,
'type': 'nzb', 'type': 'nzb',
'provider': self.getName(), 'provider': self.getName(),
'download': nzb['nzb'], 'download': self.download,
'url': nzb['nzb'],
'name': nzb['name'], 'name': nzb['name'],
'age': self.calculateAge(int(nzb['postdate'])), 'age': self.calculateAge(int(nzb['postdate'])),
'size': tryInt(nzb['size']) / 1024 / 1024, 'size': tryInt(nzb['size']) / 1024 / 1024,
'description': '',
'extra_score': extra_score,
'votes': nzb['votes'],
'check_nzb': True, 'check_nzb': True,
} }