21 changed files with 394 additions and 72 deletions
@ -1,33 +1,42 @@ |
|||||
|
from couchpotato.core.plugins.renamer.main import Renamer |
||||
|
|
||||
def start(): |
def start(): |
||||
pass |
return Renamer() |
||||
|
|
||||
#config = [{ |
config = [{ |
||||
# 'name': 'Renamer', |
'name': 'renamer', |
||||
# 'tab': 'renaming', |
'groups': [ |
||||
# 'options': { |
{ |
||||
# 'enabled': { |
'tab': 'renamer', |
||||
# 'default': False, |
'name': 'tmdb', |
||||
# 'type': 'bool', |
'label': 'TheMovieDB', |
||||
# 'description': 'Enable renaming', |
'advanced': True, |
||||
# }, |
'description': 'Move and rename your downloaded movies to your movie directory.', |
||||
# 'from': { |
'options': [ |
||||
# 'default': '', |
{ |
||||
# 'type': 'directory', |
'name': 'enabled', |
||||
# 'label': 'From', |
'default': False, |
||||
# 'description': 'Folder where the movies are downloaded to.', |
'type': 'enabler', |
||||
# }, |
}, |
||||
# 'to': { |
{ |
||||
# 'default': '', |
'name': 'from', |
||||
# 'type': 'directory', |
'type': 'directory', |
||||
# 'label': 'To', |
'description': 'Folder where the movies are downloaded to.', |
||||
# 'description': 'Folder where the movies will be moved to.', |
}, |
||||
# }, |
{ |
||||
# 'run_every': { |
'name': 'to', |
||||
# 'default': 1, |
'type': 'directory', |
||||
# 'type': 'int', |
'description': 'Folder where the movies will be moved to.', |
||||
# 'unit': 'min(s)', |
}, |
||||
# 'description': 'Search for new movies inside the folder every X minutes.', |
{ |
||||
# } |
'name': 'run_every', |
||||
# } |
'label': 'Run every', |
||||
#}] |
'default': 1, |
||||
config = [] |
'type': 'int', |
||||
|
'unit': 'min(s)', |
||||
|
'description': 'Search for new movies inside the folder every X minutes.', |
||||
|
} |
||||
|
], |
||||
|
}, |
||||
|
], |
||||
|
}] |
||||
|
@ -0,0 +1,10 @@ |
|||||
|
from couchpotato.core.logger import CPLog |
||||
|
from couchpotato.core.plugins.base import Plugin |
||||
|
|
||||
|
log = CPLog(__name__) |
||||
|
|
||||
|
|
||||
|
class Renamer(Plugin): |
||||
|
|
||||
|
def __init__(self): |
||||
|
pass |
@ -0,0 +1,29 @@ |
|||||
|
from .main import Newzbin |
||||
|
|
||||
|
def start(): |
||||
|
return Newzbin() |
||||
|
|
||||
|
config = [{ |
||||
|
'name': 'newzbin', |
||||
|
'groups': [ |
||||
|
{ |
||||
|
'tab': 'providers', |
||||
|
'name': 'newzbin', |
||||
|
'options': [ |
||||
|
{ |
||||
|
'name': 'enabled', |
||||
|
'type': 'enabler', |
||||
|
}, |
||||
|
{ |
||||
|
'name': 'username', |
||||
|
'default': '', |
||||
|
}, |
||||
|
{ |
||||
|
'name': 'password', |
||||
|
'default': '', |
||||
|
'type': 'password', |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
], |
||||
|
}] |
@ -0,0 +1,8 @@ |
|||||
|
from couchpotato.core.logger import CPLog |
||||
|
from couchpotato.core.providers.base import NZBProvider |
||||
|
|
||||
|
log = CPLog(__name__) |
||||
|
|
||||
|
|
||||
|
class Newzbin(NZBProvider): |
||||
|
pass |
@ -0,0 +1,30 @@ |
|||||
|
from .main import Newznab |
||||
|
|
||||
|
def start(): |
||||
|
return Newznab() |
||||
|
|
||||
|
config = [{ |
||||
|
'name': 'newznab', |
||||
|
'groups': [ |
||||
|
{ |
||||
|
'tab': 'providers', |
||||
|
'name': 'newznab', |
||||
|
'options': [ |
||||
|
{ |
||||
|
'name': 'enabled', |
||||
|
'type': 'enabler', |
||||
|
}, |
||||
|
{ |
||||
|
'name': 'host', |
||||
|
'default': 'http://nzb.su', |
||||
|
}, |
||||
|
{ |
||||
|
'name': 'api_key', |
||||
|
'default': '', |
||||
|
'label': 'Api Key', |
||||
|
'description': 'Can be found after login on the "API" page, bottom left. The string after "&apikey=".', |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
], |
||||
|
}] |
@ -0,0 +1,8 @@ |
|||||
|
from couchpotato.core.logger import CPLog |
||||
|
from couchpotato.core.providers.base import NZBProvider |
||||
|
|
||||
|
log = CPLog(__name__) |
||||
|
|
||||
|
|
||||
|
class Newznab(NZBProvider): |
||||
|
pass |
@ -0,0 +1,29 @@ |
|||||
|
from .main import NZBMatrix |
||||
|
|
||||
|
def start(): |
||||
|
return NZBMatrix() |
||||
|
|
||||
|
config = [{ |
||||
|
'name': 'nzbmatrix', |
||||
|
'groups': [ |
||||
|
{ |
||||
|
'tab': 'providers', |
||||
|
'name': 'nzbmatrix', |
||||
|
'label': 'NZBMatrix', |
||||
|
'options': [ |
||||
|
{ |
||||
|
'name': 'enabled', |
||||
|
'type': 'enabler', |
||||
|
}, |
||||
|
{ |
||||
|
'name': 'username', |
||||
|
}, |
||||
|
{ |
||||
|
'name': 'api_key', |
||||
|
'default': '9b939aee0aaafc12a65bf448e4af9543', |
||||
|
'label': 'Api Key', |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
], |
||||
|
}] |
@ -0,0 +1,116 @@ |
|||||
|
from couchpotato.core.logger import CPLog |
||||
|
from couchpotato.core.providers.base import NZBProvider |
||||
|
|
||||
|
log = CPLog(__name__) |
||||
|
|
||||
|
|
||||
|
class NZBMatrix(NZBProvider): |
||||
|
|
||||
|
urls = { |
||||
|
'download': 'https://api.nzbmatrix.com/v1.1/download.php?id=%s%s', |
||||
|
'detail': 'https://nzbmatrix.com/nzb-details.php?id=%s&hit=1', |
||||
|
'search': 'http://rss.nzbmatrix.com/rss.php', |
||||
|
} |
||||
|
|
||||
|
cat_ids = [ |
||||
|
([42], ['720p', '1080p']), |
||||
|
([2], ['cam', 'ts', 'dvdrip', 'tc', 'r5', 'scr']), |
||||
|
([54], ['brrip']), |
||||
|
([1], ['dvdr']), |
||||
|
] |
||||
|
cat_backup_id = 2 |
||||
|
|
||||
|
def __init__(self, config): |
||||
|
log.info('Using NZBMatrix provider') |
||||
|
|
||||
|
self.config = config |
||||
|
|
||||
|
def find(self, movie, quality, type, retry = False): |
||||
|
|
||||
|
self.cleanCache(); |
||||
|
|
||||
|
results = [] |
||||
|
if not self.enabled() or not self.isAvailable(self.searchUrl): |
||||
|
return results |
||||
|
|
||||
|
catId = self.getCatId(type) |
||||
|
arguments = urlencode({ |
||||
|
'term': movie.imdb, |
||||
|
'subcat': catId, |
||||
|
'username': self.conf('username'), |
||||
|
'apikey': self.conf('apikey'), |
||||
|
'searchin': 'weblink', |
||||
|
'english': 1 if self.conf('english') else 0, |
||||
|
}) |
||||
|
url = "%s?%s" % (self.searchUrl, arguments) |
||||
|
cacheId = str(movie.imdb) + '-' + str(catId) |
||||
|
singleCat = (len(self.catIds.get(catId)) == 1 and catId != self.catBackupId) |
||||
|
|
||||
|
try: |
||||
|
cached = False |
||||
|
if(self.cache.get(cacheId)): |
||||
|
data = True |
||||
|
cached = True |
||||
|
log.info('Getting RSS from cache: %s.' % cacheId) |
||||
|
else: |
||||
|
log.info('Searching: %s' % url) |
||||
|
data = self.urlopen(url) |
||||
|
self.cache[cacheId] = { |
||||
|
'time': time.time() |
||||
|
} |
||||
|
|
||||
|
except (IOError, URLError): |
||||
|
log.error('Failed to open %s.' % url) |
||||
|
return results |
||||
|
|
||||
|
if data: |
||||
|
try: |
||||
|
try: |
||||
|
if cached: |
||||
|
xml = self.cache[cacheId]['xml'] |
||||
|
else: |
||||
|
xml = self.getItems(data) |
||||
|
self.cache[cacheId]['xml'] = xml |
||||
|
except: |
||||
|
log.debug('No valid xml or to many requests.. You never know with %s.' % self.name) |
||||
|
return results |
||||
|
|
||||
|
for nzb in xml: |
||||
|
|
||||
|
title = self.gettextelement(nzb, "title") |
||||
|
if 'error' in title.lower(): continue |
||||
|
|
||||
|
id = int(self.gettextelement(nzb, "link").split('&')[0].partition('id=')[2]) |
||||
|
size = self.gettextelement(nzb, "description").split('<br /><b>')[2].split('> ')[1] |
||||
|
date = str(self.gettextelement(nzb, "description").split('<br /><b>')[3].partition('Added:</b> ')[2]) |
||||
|
|
||||
|
new = self.feedItem() |
||||
|
new.id = id |
||||
|
new.type = 'nzb' |
||||
|
new.name = title |
||||
|
new.date = int(time.mktime(parse(date).timetuple())) |
||||
|
new.size = self.parseSize(size) |
||||
|
new.url = self.downloadLink(id) |
||||
|
new.detailUrl = self.detailLink(id) |
||||
|
new.content = self.gettextelement(nzb, "description") |
||||
|
new.score = self.calcScore(new, movie) |
||||
|
new.checkNZB = True |
||||
|
|
||||
|
if new.date > time.time() - (int(self.config.get('NZB', 'retention')) * 24 * 60 * 60): |
||||
|
if self.isCorrectMovie(new, movie, type, imdbResults = True, singleCategory = singleCat): |
||||
|
results.append(new) |
||||
|
log.info('Found: %s' % new.name) |
||||
|
else: |
||||
|
log.info('Found outside retention: %s' % new.name) |
||||
|
|
||||
|
return results |
||||
|
except SyntaxError: |
||||
|
log.error('Failed to parse XML response from NZBMatrix.com') |
||||
|
|
||||
|
return results |
||||
|
|
||||
|
def getApiExt(self): |
||||
|
return '&username=%s&apikey=%s' % (self.conf('username'), self.conf('apikey')) |
||||
|
|
||||
|
def isEnabled(self): |
||||
|
return self.conf('enabled') and self.conf('username') and self.conf('apikey') |
@ -0,0 +1,30 @@ |
|||||
|
from .main import Nzbs |
||||
|
|
||||
|
def start(): |
||||
|
return Nzbs() |
||||
|
|
||||
|
config = [{ |
||||
|
'name': 'nzbs', |
||||
|
'groups': [ |
||||
|
{ |
||||
|
'tab': 'providers', |
||||
|
'name': 'nzbs', |
||||
|
'options': [ |
||||
|
{ |
||||
|
'name': 'enabled', |
||||
|
'type': 'enabler', |
||||
|
}, |
||||
|
{ |
||||
|
'name': 'id', |
||||
|
'label': 'Id', |
||||
|
'description': 'Can be found <a href="http://nzbs.org/index.php?action=rss" target="_blank">here</a>, the number after "&i="', |
||||
|
}, |
||||
|
{ |
||||
|
'name': 'api_key', |
||||
|
'label': 'Api Key', |
||||
|
'description': 'Can be found <a href="http://nzbs.org/index.php?action=rss" target="_blank">here</a>, the string after "&h="' |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
], |
||||
|
}] |
@ -0,0 +1,8 @@ |
|||||
|
from couchpotato.core.logger import CPLog |
||||
|
from couchpotato.core.providers.base import NZBProvider |
||||
|
|
||||
|
log = CPLog(__name__) |
||||
|
|
||||
|
|
||||
|
class Nzbs(NZBProvider): |
||||
|
pass |
@ -0,0 +1,24 @@ |
|||||
|
from .main import ThePirateBay |
||||
|
|
||||
|
def start(): |
||||
|
return ThePirateBay() |
||||
|
|
||||
|
config = [{ |
||||
|
'name': 'themoviedb', |
||||
|
'groups': [ |
||||
|
{ |
||||
|
'tab': 'providers', |
||||
|
'name': 'tmdb', |
||||
|
'label': 'TheMovieDB', |
||||
|
'advanced': True, |
||||
|
'description': 'Used for all calls to TheMovieDB.', |
||||
|
'options': [ |
||||
|
{ |
||||
|
'name': 'api_key', |
||||
|
'default': '9b939aee0aaafc12a65bf448e4af9543', |
||||
|
'label': 'Api Key', |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
], |
||||
|
}] |
@ -0,0 +1,8 @@ |
|||||
|
from couchpotato.core.logger import CPLog |
||||
|
from couchpotato.core.providers.base import TorrentProvider |
||||
|
|
||||
|
log = CPLog(__name__) |
||||
|
|
||||
|
|
||||
|
class ThePirateBay(TorrentProvider): |
||||
|
pass |
Loading…
Reference in new issue