NZBx provider
This commit is contained in:
@@ -9,8 +9,8 @@ config = [{
|
|||||||
{
|
{
|
||||||
'tab': 'searcher',
|
'tab': 'searcher',
|
||||||
'subtab': 'nzb_providers',
|
'subtab': 'nzb_providers',
|
||||||
'name': 'nzbx',
|
'name': 'nzbX',
|
||||||
'description': 'Free provider, less accurate. See <a href="https://www.nzbx.co/">nzbx</a>',
|
'description': 'Free provider, less accurate. See <a href="https://www.nzbx.co/">nzbX</a>',
|
||||||
'options': [
|
'options': [
|
||||||
{
|
{
|
||||||
'name': 'enabled',
|
'name': 'enabled',
|
||||||
|
|||||||
@@ -1,16 +1,11 @@
|
|||||||
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 tryUrlencode
|
||||||
simplifyString
|
|
||||||
from couchpotato.core.helpers.rss import RSS
|
from couchpotato.core.helpers.rss import RSS
|
||||||
from couchpotato.core.helpers.variable import tryInt, getTitle
|
from couchpotato.core.helpers.variable import tryInt
|
||||||
from couchpotato.core.logger import CPLog
|
from couchpotato.core.logger import CPLog
|
||||||
from couchpotato.core.providers.nzb.base import NZBProvider
|
from couchpotato.core.providers.nzb.base import NZBProvider
|
||||||
from couchpotato.environment import Env
|
|
||||||
from dateutil.parser import parse
|
|
||||||
import re
|
|
||||||
import time
|
|
||||||
import traceback
|
|
||||||
import json
|
import json
|
||||||
|
import traceback
|
||||||
|
|
||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
|
|
||||||
@@ -31,23 +26,21 @@ class Nzbx(NZBProvider, RSS):
|
|||||||
http_time_between_calls = 1 # Seconds
|
http_time_between_calls = 1 # Seconds
|
||||||
|
|
||||||
def search(self, movie, quality):
|
def search(self, movie, quality):
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
if self.isDisabled():
|
if self.isDisabled():
|
||||||
return results
|
return results
|
||||||
|
|
||||||
q = '"%s %s" %s' % (simplifyString(getTitle(movie['library'])), movie['library']['year'], quality.get('identifier'))
|
|
||||||
arguments = tryUrlencode({
|
arguments = tryUrlencode({
|
||||||
'q': q,
|
'q': movie['library']['identifier'].replace('tt', ''),
|
||||||
'l': 250, # Limit on number of files returned
|
'sf': quality.get('size_min'),
|
||||||
#'i': '', # index of file
|
|
||||||
#'sf': '' # size filter
|
|
||||||
})
|
})
|
||||||
url = "%s?%s" % (self.urls['search'], arguments)
|
url = "%s?%s" % (self.urls['search'], arguments)
|
||||||
|
|
||||||
cache_key = 'nzbx.%s.%s' % (movie['library']['identifier'], quality.get('identifier'))
|
cache_key = 'nzbx.%s.%s' % (movie['library']['identifier'], quality.get('identifier'))
|
||||||
|
|
||||||
data = self.getCache(cache_key, url)
|
data = self.getCache(cache_key, url)
|
||||||
|
|
||||||
if data:
|
if data:
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
@@ -64,7 +57,6 @@ class Nzbx(NZBProvider, RSS):
|
|||||||
score = 0
|
score = 0
|
||||||
if item['votes']['upvotes'] > item['votes']['downvotes']:
|
if item['votes']['upvotes'] > item['votes']['downvotes']:
|
||||||
score += 5
|
score += 5
|
||||||
|
|
||||||
return score
|
return score
|
||||||
|
|
||||||
new = {
|
new = {
|
||||||
@@ -97,5 +89,3 @@ class Nzbx(NZBProvider, RSS):
|
|||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def isEnabled(self):
|
|
||||||
return NZBProvider.isEnabled(self) and self.conf('enabled')
|
|
||||||
Reference in New Issue
Block a user