Downloading of single releases and more
This commit is contained in:
1 parent
4617750277
commit
cb5fc694ab
31 files changed
+457
-112
No files matched your search
@@ -13,10 +13,9 @@ log = CPLog(__name__)
|
||||
class Newzbin(NZBProvider, RSS):
|
||||
|
||||
urls = {
|
||||
'search': 'https://www.newzbin.com/search/',
|
||||
'download': 'http://www.newzbin.com/api/dnzb/',
|
||||
'search': 'https://www.newzbin.com/search/',
|
||||
}
|
||||
searchUrl = 'https://www.newzbin.com/search/'
|
||||
|
||||
format_ids = {
|
||||
2: ['scr'],
|
||||
@@ -36,7 +35,7 @@ class Newzbin(NZBProvider, RSS):
|
||||
def search(self, movie, quality):
|
||||
|
||||
results = []
|
||||
if self.isDisabled() or not self.isAvailable(self.searchUrl):
|
||||
if self.isDisabled() or not self.isAvailable(self.urls['search']):
|
||||
return results
|
||||
|
||||
format_id = self.getFormatId(type)
|
||||
@@ -97,11 +96,12 @@ class Newzbin(NZBProvider, RSS):
|
||||
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': lambda: self.download(id),
|
||||
'download': self.download,
|
||||
'detail_url': str(self.getTextElement(nzb, 'link')),
|
||||
'description': self.getTextElement(nzb, "description"),
|
||||
'check_nzb': False,
|
||||
@@ -121,7 +121,7 @@ class Newzbin(NZBProvider, RSS):
|
||||
|
||||
return results
|
||||
|
||||
def download(self, nzb_id):
|
||||
def download(self, url = '', nzb_id = ''):
|
||||
try:
|
||||
log.info('Download nzb from newzbin, report id: %s ' % nzb_id)
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ from couchpotato.core.logger import CPLog
|
||||
from couchpotato.core.providers.base import NZBProvider
|
||||
from dateutil.parser import parse
|
||||
from urllib import urlencode
|
||||
from urlparse import urlparse
|
||||
import time
|
||||
import xml.etree.ElementTree as XMLTree
|
||||
|
||||
@@ -130,11 +131,13 @@ class Newznab(NZBProvider, RSS):
|
||||
id = self.getTextElement(nzb, "guid").split('/')[-1:].pop()
|
||||
new = {
|
||||
'id': id,
|
||||
'provider': self.getName(),
|
||||
'type': 'nzb',
|
||||
'name': self.getTextElement(nzb, "title"),
|
||||
'age': self.calculateAge(int(time.mktime(parse(date).timetuple()))),
|
||||
'size': int(size) / 1024 / 1024,
|
||||
'url': (self.getUrl(host['host'], self.urls['download']) % id) + self.getApiExt(host),
|
||||
'download': self.download,
|
||||
'detail_url': (self.getUrl(host['host'], self.urls['detail']) % id) + self.getApiExt(host),
|
||||
'content': self.getTextElement(nzb, "description"),
|
||||
}
|
||||
@@ -173,6 +176,17 @@ class Newznab(NZBProvider, RSS):
|
||||
|
||||
return list
|
||||
|
||||
def belongsTo(self, url):
|
||||
|
||||
hosts = self.getHosts()
|
||||
|
||||
for host in hosts:
|
||||
result = super(Newznab, self).belongsTo(url, host = host['host'])
|
||||
if result:
|
||||
return result
|
||||
|
||||
return
|
||||
|
||||
def getUrl(self, host, type):
|
||||
return cleanHost(host) + 'api?t=' + type
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ log = CPLog(__name__)
|
||||
class NzbIndex(NZBProvider, RSS):
|
||||
|
||||
urls = {
|
||||
'download': 'http://www.nzbindex.nl/download/%s/%s',
|
||||
'download': 'http://www.nzbindex.nl/download/',
|
||||
'api': 'http://www.nzbindex.nl/rss/', #http://www.nzbindex.nl/rss/?q=due+date+720p&age=1000&sort=agedesc&minsize=3500&maxsize=10000
|
||||
}
|
||||
|
||||
@@ -63,10 +63,12 @@ class NzbIndex(NZBProvider, RSS):
|
||||
new = {
|
||||
'id': id,
|
||||
'type': 'nzb',
|
||||
'provider': self.getName(),
|
||||
'name': self.getTextElement(nzb, "title"),
|
||||
'age': self.calculateAge(int(time.mktime(parse(self.getTextElement(nzb, "pubDate")).timetuple()))),
|
||||
'size': enclosure['length'],
|
||||
'url': enclosure['url'],
|
||||
'download': self.download,
|
||||
'detail_url': enclosure['url'].replace('/download/', '/release/'),
|
||||
'description': self.getTextElement(nzb, "description"),
|
||||
'check_nzb': True,
|
||||
|
||||
@@ -81,10 +81,12 @@ class NZBMatrix(NZBProvider, RSS):
|
||||
new = {
|
||||
'id': 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,
|
||||
|
||||
@@ -71,10 +71,12 @@ class Nzbs(NZBProvider, RSS):
|
||||
new = {
|
||||
'id': id,
|
||||
'type': 'nzb',
|
||||
'provider': self.getName(),
|
||||
'name': self.getTextElement(nzb, "title"),
|
||||
'age': self.calculateAge(int(time.mktime(parse(self.getTextElement(nzb, "pubDate")).timetuple()))),
|
||||
'size': self.parseSize(self.getTextElement(nzb, "description").split('</a><br />')[1].split('">')[1]),
|
||||
'url': self.urls['download'] % (id, self.getApiExt()),
|
||||
'download': self.download,
|
||||
'detail_url': self.urls['detail'] % id,
|
||||
'description': self.getTextElement(nzb, "description"),
|
||||
'check_nzb': True,
|
||||
|
||||
Reference in new issue
Block a user