NZBsRus cleanup
This commit is contained in:
1 parent
7ee04e3d18
commit
3f35cba818
2 files changed
+8
-14
No files matched your search
@@ -11,6 +11,7 @@ config = [{
|
|||||||
'subtab': 'providers',
|
'subtab': 'providers',
|
||||||
'name': 'nzbsrus',
|
'name': 'nzbsrus',
|
||||||
'label': 'Nzbsrus',
|
'label': 'Nzbsrus',
|
||||||
|
'description': 'See <a href="https://www.nzbsrus.com/">NZBsRus</a>',
|
||||||
'wizard': True,
|
'wizard': True,
|
||||||
'options': [
|
'options': [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import xml.etree.ElementTree as XMLTree
|
|||||||
|
|
||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
|
|
||||||
# See the api http://www.nzbsrus.com/NzbsrusAPI.pdf
|
|
||||||
class Nzbsrus(NZBProvider, RSS):
|
class Nzbsrus(NZBProvider, RSS):
|
||||||
|
|
||||||
urls = {
|
urls = {
|
||||||
@@ -19,11 +18,8 @@ class Nzbsrus(NZBProvider, RSS):
|
|||||||
}
|
}
|
||||||
|
|
||||||
cat_ids = [
|
cat_ids = [
|
||||||
([90,45,51], ['720p', '1080p','brrip','bd50','dvdr']),
|
([90, 45, 51], ['720p', '1080p', 'brrip', 'bd50', 'dvdr']),
|
||||||
([48,51], ['cam', 'ts', 'dvdrip', 'tc', 'r5', 'scr']),
|
([48, 51], ['cam', 'ts', 'dvdrip', 'tc', 'r5', 'scr']),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
cat_backup_id = 240
|
cat_backup_id = 240
|
||||||
|
|
||||||
@@ -37,17 +33,18 @@ class Nzbsrus(NZBProvider, RSS):
|
|||||||
cat_id_string = '&'.join(['c%s=1' % x for x in self.getCatId(quality.get('identifier'))])
|
cat_id_string = '&'.join(['c%s=1' % x for x in self.getCatId(quality.get('identifier'))])
|
||||||
|
|
||||||
arguments = tryUrlencode({
|
arguments = tryUrlencode({
|
||||||
'searchtext': 'imdb:'+movie['library']['identifier'][2:],
|
'searchtext': 'imdb:' + movie['library']['identifier'][2:],
|
||||||
'uid': self.conf('userid'),
|
'uid': self.conf('userid'),
|
||||||
'key': self.conf('api_key'),
|
'key': self.conf('api_key'),
|
||||||
'age': Env.setting('retention', section = 'nzb'),
|
'age': Env.setting('retention', section = 'nzb'),
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
# check for english_only
|
# check for english_only
|
||||||
if self.conf('english_only'):
|
if self.conf('english_only'):
|
||||||
arguments += "&lang0=1&lang3=1&lang1=1"
|
arguments += "&lang0=1&lang3=1&lang1=1"
|
||||||
|
|
||||||
url = "%s&%s&%s" % (self.urls['search'], arguments ,cat_id_string)
|
url = "%s&%s&%s" % (self.urls['search'], arguments , cat_id_string)
|
||||||
|
|
||||||
cache_key = 'nzbsrus_1.%s.%s' % (movie['library'].get('identifier'), cat_id_string)
|
cache_key = 'nzbsrus_1.%s.%s' % (movie['library'].get('identifier'), cat_id_string)
|
||||||
single_cat = True
|
single_cat = True
|
||||||
@@ -69,9 +66,8 @@ class Nzbsrus(NZBProvider, RSS):
|
|||||||
|
|
||||||
id = self.getTextElement(nzb, "id")
|
id = self.getTextElement(nzb, "id")
|
||||||
size = int(round(int(self.getTextElement(nzb, "size")) / 1048576))
|
size = int(round(int(self.getTextElement(nzb, "size")) / 1048576))
|
||||||
age = int(round(( time.time() - int(self.getTextElement(nzb, "postdate")) ) / 86400 ))
|
age = int(round((time.time() - int(self.getTextElement(nzb, "postdate"))) / 86400))
|
||||||
|
|
||||||
|
|
||||||
new = {
|
new = {
|
||||||
'id': id,
|
'id': id,
|
||||||
'type': 'nzb',
|
'type': 'nzb',
|
||||||
@@ -88,7 +84,7 @@ class Nzbsrus(NZBProvider, RSS):
|
|||||||
|
|
||||||
is_correct_movie = fireEvent('searcher.correct_movie',
|
is_correct_movie = fireEvent('searcher.correct_movie',
|
||||||
nzb = new, movie = movie, quality = quality,
|
nzb = new, movie = movie, quality = quality,
|
||||||
imdb_results = True, single_category = single_cat, single = True)
|
imdb_results = True, single = True)
|
||||||
|
|
||||||
if is_correct_movie:
|
if is_correct_movie:
|
||||||
new['score'] = fireEvent('score.calculate', new, movie, single = True)
|
new['score'] = fireEvent('score.calculate', new, movie, single = True)
|
||||||
@@ -106,6 +102,3 @@ class Nzbsrus(NZBProvider, RSS):
|
|||||||
|
|
||||||
def getApiExt(self):
|
def getApiExt(self):
|
||||||
return '/%s/' % (self.conf('userid'))
|
return '/%s/' % (self.conf('userid'))
|
||||||
|
|
||||||
def isEnabled(self):
|
|
||||||
return NZBProvider.isEnabled(self) and self.conf('userid') and self.conf('api_key')
|
|
||||||
Reference in new issue
Block a user