6 changed files with 0 additions and 454 deletions
@ -1,32 +0,0 @@ |
|||||
from .main import Kere |
|
||||
|
|
||||
def start(): |
|
||||
return Kere() |
|
||||
|
|
||||
config = [{ |
|
||||
'name': 'kere', |
|
||||
'groups': [ |
|
||||
{ |
|
||||
'tab': 'searcher', |
|
||||
'subtab': 'nzb_providers', |
|
||||
'name': 'kere', |
|
||||
'label': 'Kere', |
|
||||
'description': 'See <a href="http://kere.ws/">Kere</a>', |
|
||||
'wizard': True, |
|
||||
'options': [ |
|
||||
{ |
|
||||
'name': 'enabled', |
|
||||
'type': 'enabler', |
|
||||
}, |
|
||||
{ |
|
||||
'name': 'username', |
|
||||
}, |
|
||||
{ |
|
||||
'name': 'api_key', |
|
||||
'default': '', |
|
||||
'label': 'Api Key', |
|
||||
}, |
|
||||
], |
|
||||
}, |
|
||||
], |
|
||||
}] |
|
@ -1,106 +0,0 @@ |
|||||
from couchpotato.core.event import fireEvent |
|
||||
from couchpotato.core.helpers.encoding import tryUrlencode |
|
||||
from couchpotato.core.helpers.rss import RSS |
|
||||
from couchpotato.core.logger import CPLog |
|
||||
from couchpotato.core.providers.nzb.base import NZBProvider |
|
||||
from couchpotato.environment import Env |
|
||||
from libs.dateutil.parser import parse |
|
||||
import time |
|
||||
import xml.etree.ElementTree as XMLTree |
|
||||
|
|
||||
log = CPLog(__name__) |
|
||||
|
|
||||
|
|
||||
class Kere(NZBProvider, RSS): |
|
||||
|
|
||||
urls = { |
|
||||
'download': 'http://kere.ws/api?t=get&id=%s', |
|
||||
'detail': 'http://kere.ws/api?t=details&id=%s', |
|
||||
'search': 'http://kere.ws/api', |
|
||||
} |
|
||||
|
|
||||
cat_ids = [ |
|
||||
([1000], [ 'cam', 'ts', 'tc', 'scr']), |
|
||||
([1010], [ 'r5' ]), |
|
||||
([1020], [ 'dvdrip', 'brrip' ]), |
|
||||
([1030], [ 'dvdr' ]), |
|
||||
([1050], [ '720p' ]), |
|
||||
([1060], [ '1080p' ]), |
|
||||
] |
|
||||
cat_backup_id = 2 |
|
||||
|
|
||||
def search(self, movie, quality): |
|
||||
|
|
||||
results = [] |
|
||||
|
|
||||
if self.isDisabled(): |
|
||||
return results |
|
||||
|
|
||||
cat_ids = ','.join(['%s' % x for x in self.getCatId(quality.get('identifier'))]) |
|
||||
|
|
||||
arguments = tryUrlencode({ |
|
||||
't' : 'movie', |
|
||||
'imdbid': movie['library']['identifier'].replace('tt',''), |
|
||||
'cat': cat_ids, |
|
||||
'apikey': self.conf('api_key'), |
|
||||
}) |
|
||||
url = "%s?%s" % (self.urls['search'], arguments) |
|
||||
|
|
||||
cache_key = 'kere.%s.%s' % (movie['library'].get('identifier'), cat_ids) |
|
||||
|
|
||||
data = self.getCache(cache_key, url, cache_timeout = 1800, headers = {'User-Agent': Env.getIdentifier()}) |
|
||||
if data: |
|
||||
try: |
|
||||
try: |
|
||||
data = XMLTree.fromstring(data) |
|
||||
nzbs = self.getElements(data, 'channel/item') |
|
||||
except Exception, e: |
|
||||
log.debug('%s, %s', (self.getName(), e)) |
|
||||
return results |
|
||||
|
|
||||
for nzb in nzbs: |
|
||||
|
|
||||
title = self.getTextElement(nzb, "title") |
|
||||
if 'error' in title.lower(): continue |
|
||||
|
|
||||
id = self.getTextElement(nzb, "link").replace('http://kere.ws/getnzb/','').split('.')[0] |
|
||||
size = '%f KB' % (float(str(nzb.find('enclosure').attrib).split("'length': ")[1].split(',')[0].strip("'").strip()) / 1024) |
|
||||
date = str(self.getTextElement(nzb, "pubDate")) |
|
||||
|
|
||||
new = { |
|
||||
'id': str(id), |
|
||||
'type': 'nzb', |
|
||||
'provider': self.getName(), |
|
||||
'name': title, |
|
||||
'age': self.calculateAge(int(time.mktime(parse(date).timetuple()))), |
|
||||
'size': self.parseSize(size), |
|
||||
'url': self.urls['download'] % id + self.getApiExt(), |
|
||||
'download': self.download, |
|
||||
'detail_url': self.urls['detail'] % id, |
|
||||
'description': self.getTextElement(nzb, "description"), |
|
||||
'check_nzb': True, |
|
||||
} |
|
||||
|
|
||||
is_correct_movie = fireEvent('searcher.correct_movie', |
|
||||
nzb = new, movie = movie, quality = quality, |
|
||||
imdb_results = True, single = True) |
|
||||
|
|
||||
if is_correct_movie: |
|
||||
new['score'] = fireEvent('score.calculate', new, movie, single = True) |
|
||||
results.append(new) |
|
||||
self.found(new) |
|
||||
|
|
||||
return results |
|
||||
except SyntaxError: |
|
||||
log.error('Failed to parse XML response from Kere.ws') |
|
||||
|
|
||||
return results |
|
||||
|
|
||||
def download(self, url = '', nzb_id = ''): |
|
||||
return self.urlopen(url, headers = {'User-Agent': Env.getIdentifier()}) |
|
||||
|
|
||||
def getApiExt(self): |
|
||||
return '&username=%s&apikey=%s' % (self.conf('username'), self.conf('api_key')) |
|
||||
|
|
||||
def isEnabled(self): |
|
||||
return NZBProvider.isEnabled(self) and self.conf('username') and self.conf('api_key') |
|
@ -1,23 +0,0 @@ |
|||||
from .main import Mysterbin |
|
||||
|
|
||||
def start(): |
|
||||
return Mysterbin() |
|
||||
|
|
||||
config = [{ |
|
||||
'name': 'mysterbin', |
|
||||
'groups': [ |
|
||||
{ |
|
||||
'tab': 'searcher', |
|
||||
'subtab': 'nzb_providers', |
|
||||
'name': 'Mysterbin', |
|
||||
'description': 'Free provider, less accurate. See <a href="https://www.mysterbin.com/">Mysterbin</a>', |
|
||||
'options': [ |
|
||||
{ |
|
||||
'name': 'enabled', |
|
||||
'type': 'enabler', |
|
||||
'default': True, |
|
||||
}, |
|
||||
], |
|
||||
}, |
|
||||
], |
|
||||
}] |
|
@ -1,102 +0,0 @@ |
|||||
from bs4 import BeautifulSoup |
|
||||
from couchpotato.core.event import fireEvent |
|
||||
from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode, \ |
|
||||
simplifyString |
|
||||
from couchpotato.core.helpers.variable import tryInt, getTitle |
|
||||
from couchpotato.core.logger import CPLog |
|
||||
from couchpotato.core.providers.nzb.base import NZBProvider |
|
||||
from couchpotato.environment import Env |
|
||||
|
|
||||
log = CPLog(__name__) |
|
||||
|
|
||||
|
|
||||
class Mysterbin(NZBProvider): |
|
||||
|
|
||||
urls = { |
|
||||
'search': 'https://www.mysterbin.com/advsearch?%s', |
|
||||
'download': 'https://www.mysterbin.com/nzb?c=%s', |
|
||||
'nfo': 'https://www.mysterbin.com/nfo?c=%s', |
|
||||
} |
|
||||
|
|
||||
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')) |
|
||||
for ignored in Env.setting('ignored_words', 'searcher').split(','): |
|
||||
if len(q) + len(ignored.strip()) > 126: |
|
||||
break |
|
||||
q = '%s -%s' % (q, ignored.strip()) |
|
||||
|
|
||||
params = { |
|
||||
'q': q, |
|
||||
'match': 'normal', |
|
||||
'minSize': quality.get('size_min'), |
|
||||
'maxSize': quality.get('size_max'), |
|
||||
'complete': 2, |
|
||||
'maxAge': Env.setting('retention', 'nzb'), |
|
||||
'nopasswd': 'on', |
|
||||
} |
|
||||
|
|
||||
cache_key = 'mysterbin.%s.%s.%s' % (movie['library']['identifier'], quality.get('identifier'), q) |
|
||||
data = self.getCache(cache_key, self.urls['search'] % tryUrlencode(params)) |
|
||||
if data: |
|
||||
|
|
||||
try: |
|
||||
html = BeautifulSoup(data) |
|
||||
resultable = html.find('table', attrs = {'class':'t'}) |
|
||||
for result in resultable.find_all('tr'): |
|
||||
|
|
||||
try: |
|
||||
myster_id = result.find('input', attrs = {'class': 'check4nzb'})['value'] |
|
||||
|
|
||||
# Age |
|
||||
age = '' |
|
||||
for temp in result.find('td', attrs = {'class': 'cdetail'}).find_all(text = True): |
|
||||
if 'days' in temp: |
|
||||
age = tryInt(temp.split(' ')[0]) |
|
||||
break |
|
||||
|
|
||||
# size |
|
||||
size = None |
|
||||
for temp in result.find('div', attrs = {'class': 'cdetail'}).find_all(text = True): |
|
||||
if 'gb' in temp.lower() or 'mb' in temp.lower() or 'kb' in temp.lower(): |
|
||||
size = self.parseSize(temp) |
|
||||
break |
|
||||
|
|
||||
description = '' |
|
||||
if result.find('a', text = 'View NFO'): |
|
||||
description = toUnicode(self.getCache('mysterbin.%s' % myster_id, self.urls['nfo'] % myster_id, cache_timeout = 25920000)) |
|
||||
|
|
||||
new = { |
|
||||
'id': myster_id, |
|
||||
'name': ''.join(result.find('span', attrs = {'class': 'cname'}).find_all(text = True)), |
|
||||
'type': 'nzb', |
|
||||
'provider': self.getName(), |
|
||||
'age': age, |
|
||||
'size': size, |
|
||||
'url': self.urls['download'] % myster_id, |
|
||||
'description': description, |
|
||||
'download': self.download, |
|
||||
'check_nzb': False, |
|
||||
} |
|
||||
|
|
||||
new['score'] = fireEvent('score.calculate', new, movie, single = True) |
|
||||
is_correct_movie = fireEvent('searcher.correct_movie', |
|
||||
nzb = new, movie = movie, quality = quality, |
|
||||
imdb_results = False, single = True) |
|
||||
if is_correct_movie: |
|
||||
results.append(new) |
|
||||
self.found(new) |
|
||||
except: |
|
||||
pass |
|
||||
|
|
||||
return results |
|
||||
except AttributeError: |
|
||||
log.debug('No search results found.') |
|
||||
|
|
||||
return results |
|
@ -1,32 +0,0 @@ |
|||||
from .main import Newzbin |
|
||||
|
|
||||
def start(): |
|
||||
return Newzbin() |
|
||||
|
|
||||
config = [{ |
|
||||
'name': 'newzbin', |
|
||||
'groups': [ |
|
||||
{ |
|
||||
'tab': 'searcher', |
|
||||
'subtab': 'nzb_providers', |
|
||||
'name': 'newzbin', |
|
||||
'description': 'See <a href="https://www.newzbin2.es/">Newzbin</a>', |
|
||||
'wizard': True, |
|
||||
'options': [ |
|
||||
{ |
|
||||
'name': 'enabled', |
|
||||
'type': 'enabler', |
|
||||
}, |
|
||||
{ |
|
||||
'name': 'username', |
|
||||
'default': '', |
|
||||
}, |
|
||||
{ |
|
||||
'name': 'password', |
|
||||
'default': '', |
|
||||
'type': 'password', |
|
||||
}, |
|
||||
], |
|
||||
}, |
|
||||
], |
|
||||
}] |
|
@ -1,159 +0,0 @@ |
|||||
from couchpotato.core.event import fireEvent |
|
||||
from couchpotato.core.helpers.encoding import tryUrlencode |
|
||||
from couchpotato.core.helpers.rss import RSS |
|
||||
from couchpotato.core.logger import CPLog |
|
||||
from couchpotato.core.providers.nzb.base import NZBProvider |
|
||||
from dateutil.parser import parse |
|
||||
import base64 |
|
||||
import time |
|
||||
import xml.etree.ElementTree as XMLTree |
|
||||
|
|
||||
log = CPLog(__name__) |
|
||||
|
|
||||
|
|
||||
class Newzbin(NZBProvider, RSS): |
|
||||
|
|
||||
urls = { |
|
||||
'download': 'https://www.newzbin2.es/api/dnzb/', |
|
||||
'search': 'https://www.newzbin2.es/search/', |
|
||||
} |
|
||||
|
|
||||
format_ids = { |
|
||||
2: ['scr'], |
|
||||
1: ['cam'], |
|
||||
4: ['tc'], |
|
||||
8: ['ts'], |
|
||||
1024: ['r5'], |
|
||||
} |
|
||||
cat_ids = [ |
|
||||
([262144], ['bd50']), |
|
||||
([2097152], ['1080p']), |
|
||||
([524288], ['720p']), |
|
||||
([262144], ['brrip']), |
|
||||
([2], ['dvdr']), |
|
||||
] |
|
||||
cat_backup_id = -1 |
|
||||
|
|
||||
http_time_between_calls = 3 # Seconds |
|
||||
|
|
||||
def search(self, movie, quality): |
|
||||
|
|
||||
results = [] |
|
||||
if self.isDisabled(): |
|
||||
return results |
|
||||
|
|
||||
format_id = self.getFormatId(type) |
|
||||
cat_id = self.getCatId(type) |
|
||||
|
|
||||
arguments = tryUrlencode({ |
|
||||
'searchaction': 'Search', |
|
||||
'u_url_posts_only': '0', |
|
||||
'u_show_passworded': '0', |
|
||||
'q_url': 'imdb.com/title/' + movie['library']['identifier'], |
|
||||
'sort': 'ps_totalsize', |
|
||||
'order': 'asc', |
|
||||
'u_post_results_amt': '100', |
|
||||
'feed': 'rss', |
|
||||
'category': '6', |
|
||||
'ps_rb_video_format': str(cat_id), |
|
||||
'ps_rb_source': str(format_id), |
|
||||
'u_post_larger_than': quality.get('size_min'), |
|
||||
'u_post_smaller_than': quality.get('size_max'), |
|
||||
}) |
|
||||
|
|
||||
url = "%s?%s" % (self.urls['search'], arguments) |
|
||||
cache_key = str('newzbin.%s.%s.%s' % (movie['library']['identifier'], str(format_id), str(cat_id))) |
|
||||
|
|
||||
data = self.getCache(cache_key) |
|
||||
if not data: |
|
||||
|
|
||||
headers = { |
|
||||
'Authorization': "Basic %s" % base64.encodestring('%s:%s' % (self.conf('username'), self.conf('password')))[:-1] |
|
||||
} |
|
||||
try: |
|
||||
data = self.urlopen(url, headers = headers) |
|
||||
self.setCache(cache_key, data) |
|
||||
except: |
|
||||
return results |
|
||||
|
|
||||
if data: |
|
||||
try: |
|
||||
try: |
|
||||
data = XMLTree.fromstring(data) |
|
||||
nzbs = self.getElements(data, 'channel/item') |
|
||||
except Exception, e: |
|
||||
log.debug('%s, %s', (self.getName(), e)) |
|
||||
return results |
|
||||
|
|
||||
for nzb in nzbs: |
|
||||
|
|
||||
title = self.getTextElement(nzb, "title") |
|
||||
if 'error' in title.lower(): continue |
|
||||
|
|
||||
REPORT_NS = 'http://www.newzbin2.es/DTD/2007/feeds/report/'; |
|
||||
|
|
||||
# Add attributes to name |
|
||||
try: |
|
||||
use_attr = ['Source', 'Video Fmt', 'Audio Fmt', 'Language'] |
|
||||
for attr in nzb.find('{%s}attributes' % REPORT_NS): |
|
||||
if attr.get("type") in use_attr: |
|
||||
title += ' ' + attr.text |
|
||||
except: |
|
||||
pass |
|
||||
|
|
||||
id = int(self.getTextElement(nzb, '{%s}id' % REPORT_NS)) |
|
||||
size = str(int(self.getTextElement(nzb, '{%s}size' % REPORT_NS)) / 1024 / 1024) + ' mb' |
|
||||
date = str(self.getTextElement(nzb, '{%s}postdate' % REPORT_NS)) |
|
||||
|
|
||||
new = { |
|
||||
'id': id, |
|
||||
'type': 'nzb', |
|
||||
'provider': self.getName(), |
|
||||
'name': title, |
|
||||
'age': self.calculateAge(int(time.mktime(parse(date).timetuple()))), |
|
||||
'size': self.parseSize(size), |
|
||||
'url': str(self.getTextElement(nzb, '{%s}nzb' % REPORT_NS)), |
|
||||
'download': self.download, |
|
||||
'detail_url': str(self.getTextElement(nzb, 'link')), |
|
||||
'description': self.getTextElement(nzb, "description"), |
|
||||
'check_nzb': False, |
|
||||
} |
|
||||
|
|
||||
is_correct_movie = fireEvent('searcher.correct_movie', |
|
||||
nzb = new, movie = movie, quality = quality, |
|
||||
imdb_results = True, single = True) |
|
||||
if is_correct_movie: |
|
||||
new['score'] = fireEvent('score.calculate', new, movie, single = True) |
|
||||
results.append(new) |
|
||||
self.found(new) |
|
||||
|
|
||||
return results |
|
||||
except SyntaxError: |
|
||||
log.error('Failed to parse XML response from newzbin') |
|
||||
|
|
||||
return results |
|
||||
|
|
||||
def download(self, url = '', nzb_id = ''): |
|
||||
try: |
|
||||
log.info('Download nzb from newzbin, report id: %s ', nzb_id) |
|
||||
|
|
||||
return self.urlopen(self.urls['download'], params = { |
|
||||
'username' : self.conf('username'), |
|
||||
'password' : self.conf('password'), |
|
||||
'reportid' : nzb_id |
|
||||
}, show_error = False) |
|
||||
except Exception, e: |
|
||||
log.error('Failed downloading from newzbin, check credit: %s', e) |
|
||||
|
|
||||
return 'try_next' |
|
||||
|
|
||||
def getFormatId(self, format): |
|
||||
for id, quality in self.format_ids.iteritems(): |
|
||||
for q in quality: |
|
||||
if q == format: |
|
||||
return id |
|
||||
|
|
||||
return self.cat_backup_id |
|
||||
|
|
||||
def isEnabled(self): |
|
||||
return NZBProvider.isEnabled(self) and self.conf('enabled') and self.conf('username') and self.conf('password') |
|
Loading…
Reference in new issue