|
|
@ -1,16 +1,11 @@ |
|
|
|
from couchpotato.core.event import fireEvent |
|
|
|
from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode, \ |
|
|
|
simplifyString |
|
|
|
from couchpotato.core.helpers.encoding import tryUrlencode |
|
|
|
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.providers.nzb.base import NZBProvider |
|
|
|
from couchpotato.environment import Env |
|
|
|
from dateutil.parser import parse |
|
|
|
import re |
|
|
|
import time |
|
|
|
import traceback |
|
|
|
import json |
|
|
|
import traceback |
|
|
|
|
|
|
|
log = CPLog(__name__) |
|
|
|
|
|
|
@ -31,23 +26,21 @@ class Nzbx(NZBProvider, RSS): |
|
|
|
http_time_between_calls = 1 # Seconds |
|
|
|
|
|
|
|
def search(self, movie, quality): |
|
|
|
|
|
|
|
results = [] |
|
|
|
|
|
|
|
if self.isDisabled(): |
|
|
|
return results |
|
|
|
|
|
|
|
q = '"%s %s" %s' % (simplifyString(getTitle(movie['library'])), movie['library']['year'], quality.get('identifier')) |
|
|
|
arguments = tryUrlencode({ |
|
|
|
'q': q, |
|
|
|
'l': 250, # Limit on number of files returned |
|
|
|
#'i': '', # index of file |
|
|
|
#'sf': '' # size filter |
|
|
|
'q': movie['library']['identifier'].replace('tt', ''), |
|
|
|
'sf': quality.get('size_min'), |
|
|
|
}) |
|
|
|
url = "%s?%s" % (self.urls['search'], arguments) |
|
|
|
|
|
|
|
cache_key = 'nzbx.%s.%s' % (movie['library']['identifier'], quality.get('identifier')) |
|
|
|
|
|
|
|
data = self.getCache(cache_key, url) |
|
|
|
|
|
|
|
if data: |
|
|
|
try: |
|
|
|
try: |
|
|
@ -64,7 +57,6 @@ class Nzbx(NZBProvider, RSS): |
|
|
|
score = 0 |
|
|
|
if item['votes']['upvotes'] > item['votes']['downvotes']: |
|
|
|
score += 5 |
|
|
|
|
|
|
|
return score |
|
|
|
|
|
|
|
new = { |
|
|
@ -97,5 +89,3 @@ class Nzbx(NZBProvider, RSS): |
|
|
|
|
|
|
|
return results |
|
|
|
|
|
|
|
def isEnabled(self): |
|
|
|
return NZBProvider.isEnabled(self) and self.conf('enabled') |