Merge branch 'refs/heads/develop'
This commit is contained in:
@@ -33,7 +33,6 @@ class Updater(Plugin):
|
|||||||
else:
|
else:
|
||||||
self.updater = SourceUpdater()
|
self.updater = SourceUpdater()
|
||||||
|
|
||||||
addEvent('app.load', self.autoUpdate)
|
|
||||||
addEvent('app.load', self.setCrons)
|
addEvent('app.load', self.setCrons)
|
||||||
addEvent('updater.info', self.info)
|
addEvent('updater.info', self.info)
|
||||||
|
|
||||||
@@ -81,8 +80,8 @@ class Updater(Plugin):
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def check(self):
|
def check(self, force = False):
|
||||||
if self.isDisabled():
|
if not force and self.isDisabled():
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.updater.check():
|
if self.updater.check():
|
||||||
@@ -101,7 +100,7 @@ class Updater(Plugin):
|
|||||||
|
|
||||||
def checkView(self):
|
def checkView(self):
|
||||||
return jsonified({
|
return jsonified({
|
||||||
'update_available': self.check(),
|
'update_available': self.check(force = True),
|
||||||
'info': self.updater.info()
|
'info': self.updater.info()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
from .main import TorrentShack
|
||||||
|
|
||||||
|
def start():
|
||||||
|
return TorrentShack()
|
||||||
|
|
||||||
|
config = [{
|
||||||
|
'name': 'torrentshack',
|
||||||
|
'groups': [
|
||||||
|
{
|
||||||
|
'tab': 'searcher',
|
||||||
|
'subtab': 'providers',
|
||||||
|
'list': 'torrent_providers',
|
||||||
|
'name': 'TorrentShack',
|
||||||
|
'description': 'See <a href="http://www.torrentshack.net/">TorrentShack</a>',
|
||||||
|
'options': [
|
||||||
|
{
|
||||||
|
'name': 'enabled',
|
||||||
|
'type': 'enabler',
|
||||||
|
'default': False,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'username',
|
||||||
|
'default': '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'password',
|
||||||
|
'default': '',
|
||||||
|
'type': 'password',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'scene_only',
|
||||||
|
'type': 'bool',
|
||||||
|
'default': False,
|
||||||
|
'description': 'Only allow scene releases.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'extra_score',
|
||||||
|
'advanced': True,
|
||||||
|
'label': 'Extra Score',
|
||||||
|
'type': 'int',
|
||||||
|
'default': 0,
|
||||||
|
'description': 'Starting score for each release found via this provider.',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}]
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
from bs4 import BeautifulSoup
|
||||||
|
from couchpotato.core.helpers.encoding import tryUrlencode
|
||||||
|
from couchpotato.core.helpers.variable import tryInt
|
||||||
|
from couchpotato.core.logger import CPLog
|
||||||
|
from couchpotato.core.providers.torrent.base import TorrentProvider
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
log = CPLog(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class TorrentShack(TorrentProvider):
|
||||||
|
|
||||||
|
urls = {
|
||||||
|
'test' : 'http://www.torrentshack.net/',
|
||||||
|
'login' : 'http://www.torrentshack.net/login.php',
|
||||||
|
'detail' : 'http://www.torrentshack.net/torrent/%s',
|
||||||
|
'search' : 'http://www.torrentshack.net/torrents.php?searchstr=%s&filter_cat[%d]=1',
|
||||||
|
'download' : 'http://www.torrentshack.net/%s',
|
||||||
|
}
|
||||||
|
|
||||||
|
cat_ids = [
|
||||||
|
([970], ['bd50']),
|
||||||
|
([300], ['720p', '1080p']),
|
||||||
|
([350], ['dvdr']),
|
||||||
|
([400], ['brrip', 'dvdrip']),
|
||||||
|
]
|
||||||
|
|
||||||
|
http_time_between_calls = 1 #seconds
|
||||||
|
cat_backup_id = None
|
||||||
|
|
||||||
|
def _searchOnTitle(self, title, movie, quality, results):
|
||||||
|
|
||||||
|
url = self.urls['search'] % (tryUrlencode('"%s" %s' % (title.replace(':', ''), movie['library']['year'])), self.getCatId(quality['identifier'])[0])
|
||||||
|
data = self.getHTMLData(url, opener = self.login_opener)
|
||||||
|
|
||||||
|
if data:
|
||||||
|
html = BeautifulSoup(data)
|
||||||
|
|
||||||
|
try:
|
||||||
|
result_table = html.find('table', attrs = {'id' : 'torrent_table'})
|
||||||
|
if not result_table:
|
||||||
|
return
|
||||||
|
|
||||||
|
entries = result_table.find_all('tr', attrs = {'class' : 'torrent'})
|
||||||
|
|
||||||
|
for result in entries:
|
||||||
|
|
||||||
|
link = result.find('span', attrs = {'class' : 'torrent_name_link'}).parent
|
||||||
|
url = result.find('td', attrs = {'class' : 'torrent_td'}).find('a')
|
||||||
|
|
||||||
|
extra_info = ''
|
||||||
|
if result.find('span', attrs = {'class' : 'torrent_extra_info'}):
|
||||||
|
extra_info = result.find('span', attrs = {'class' : 'torrent_extra_info'}).text
|
||||||
|
|
||||||
|
if not self.conf('scene_only') or extra_info != '[NotScene]':
|
||||||
|
results.append({
|
||||||
|
'id': link['href'].replace('torrents.php?torrentid=', ''),
|
||||||
|
'name': unicode(link.span.string).translate({ord(u'\xad'): None}),
|
||||||
|
'url': self.urls['download'] % url['href'],
|
||||||
|
'detail_url': self.urls['download'] % link['href'],
|
||||||
|
'download': self.loginDownload,
|
||||||
|
'size': self.parseSize(result.find_all('td')[4].string),
|
||||||
|
'seeders': tryInt(result.find_all('td')[6].string),
|
||||||
|
'leechers': tryInt(result.find_all('td')[7].string),
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
log.info('Not adding release %s [NotScene]' % unicode(link.span.string).translate({ord(u'\xad'): None}))
|
||||||
|
|
||||||
|
except:
|
||||||
|
log.error('Failed to parsing %s: %s', (self.getName(), traceback.format_exc()))
|
||||||
|
|
||||||
|
def getLoginParams(self):
|
||||||
|
return tryUrlencode({
|
||||||
|
'username': self.conf('username'),
|
||||||
|
'password': self.conf('password'),
|
||||||
|
'keeplogged': '1',
|
||||||
|
'login': 'Login',
|
||||||
|
})
|
||||||
|
|
||||||
|
def loginSuccess(self, output):
|
||||||
|
return 'logout.php' in output.lower()
|
||||||
Reference in New Issue
Block a user