mirror of https://github.com/evilhero/mylar
IMP(#2170): Added Deluge Test Button, FIX: "Error fetching data from WWT (https://worldwidetorrents.to/download.php): global name 'newurl' is not defined"
This commit is contained in:
parent
f847ac6f04
commit
14c933594b
|
@ -502,8 +502,8 @@
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<legend>Torrents</legend>
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
<legend>Torrents</legend>
|
||||||
<div class="row checkbox">
|
<div class="row checkbox">
|
||||||
<input id="enable_torrents" type="checkbox" onclick="initConfigCheckbox($(this));" name="enable_torrents" value=1 ${config['enable_torrents']} /><label>Use Torrents</label>
|
<input id="enable_torrents" type="checkbox" onclick="initConfigCheckbox($(this));" name="enable_torrents" value=1 ${config['enable_torrents']} /><label>Use Torrents</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -657,23 +657,26 @@
|
||||||
<fieldset id="deluge_options">
|
<fieldset id="deluge_options">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label>Deluge Host:Port </label>
|
<label>Deluge Host:Port </label>
|
||||||
<input type="text" name="deluge_host" value="${config['deluge_host']}" size="30">
|
<input type="text" id="deluge_host" name="deluge_host" value="${config['deluge_host']}" size="30">
|
||||||
<small>(ie. 192.168.1.2:58846) port uses the deluge daemon port (remote connection to daemon has to be enabled)</small>
|
<small>(ie. 192.168.1.2:58846) port uses the deluge daemon port (remote connection to daemon has to be enabled)</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label>Deluge Username</label>
|
<label>Deluge Username</label>
|
||||||
<input type="text" name="deluge_username" value="${config['deluge_username']}" size="30">
|
<input type="text" id="deluge_username" name="deluge_username" value="${config['deluge_username']}" size="30">
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label>Deluge Password</label>
|
<label>Deluge Password</label>
|
||||||
<input type="password" name="deluge_password" value="${config['deluge_password']}" size="30">
|
<input type="password" id="deluge_password" name="deluge_password" value="${config['deluge_password']}" size="30">
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label>Deluge Label</label>
|
<label>Deluge Label</label>
|
||||||
<input type="text" name="deluge_label" value="${config['deluge_label']}" size="30"><br/>
|
<input type="text" name="deluge_label" value="${config['deluge_label']}" size="30"><br/>
|
||||||
<small>Label to be used on the torrents</small>
|
<small>Label to be used on the torrents</small>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
<div class="row">
|
||||||
|
<img name="deluge_status_icon" id="deluge_status_icon" src="interfaces/default/images/successs.png" style="float:right;visibility:hidden;" height="20" width="20" />
|
||||||
|
<input type="button" value="Test Connection" id="deluge_test" /><br/>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset id="qbittorrent_options">
|
<fieldset id="qbittorrent_options">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -718,6 +721,7 @@
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -2226,6 +2230,32 @@
|
||||||
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
|
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#deluge_test').click(function () {
|
||||||
|
var imagechk = document.getElementById("deluge_status_icon");
|
||||||
|
var host = document.getElementById("deluge_host").value;
|
||||||
|
var username = document.getElementById("deluge_username").value;
|
||||||
|
var password = document.getElementById("deluge_password").value;
|
||||||
|
$.get("testdeluge",
|
||||||
|
{ host: host, username: username, password: password },
|
||||||
|
function(data){
|
||||||
|
if (data.error != undefined) {
|
||||||
|
alert(data.error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$('#ajaxMsg').html("<div class='msg'><span class='ui-icon ui-icon-check'></span>"+data+"</div>");
|
||||||
|
if ( data.indexOf("Successfully") > -1){
|
||||||
|
imagechk.src = "";
|
||||||
|
imagechk.src = "interfaces/default/images/success.png";
|
||||||
|
imagechk.style.visibility = "visible";
|
||||||
|
} else {
|
||||||
|
imagechk.src = "";
|
||||||
|
imagechk.src = "interfaces/default/images/fail.png";
|
||||||
|
imagechk.style.visibility = "visible";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
|
||||||
|
});
|
||||||
|
|
||||||
$(".newznabtest").click(function () {
|
$(".newznabtest").click(function () {
|
||||||
var newznab = this.attributes["name"].value.replace('newznab_test', '');
|
var newznab = this.attributes["name"].value.replace('newznab_test', '');
|
||||||
if ( newznab.indexOf("test_dognzb") > -1) {
|
if ( newznab.indexOf("test_dognzb") > -1) {
|
||||||
|
|
|
@ -1102,7 +1102,7 @@ def torsend2client(seriesname, issue, seriesyear, linkit, site, pubhash=None):
|
||||||
scraper = cfscrape.create_scraper()
|
scraper = cfscrape.create_scraper()
|
||||||
if site == 'WWT':
|
if site == 'WWT':
|
||||||
if mylar.WWT_CF_COOKIEVALUE is None:
|
if mylar.WWT_CF_COOKIEVALUE is None:
|
||||||
cf_cookievalue, cf_user_agent = scraper.get_tokens(newurl, user_agent=mylar.CV_HEADERS['User-Agent'])
|
cf_cookievalue, cf_user_agent = scraper.get_tokens(url, user_agent=mylar.CV_HEADERS['User-Agent'])
|
||||||
mylar.WWT_CF_COOKIEVALUE = cf_cookievalue
|
mylar.WWT_CF_COOKIEVALUE = cf_cookievalue
|
||||||
r = scraper.get(url, params=payload, cookies=mylar.WWT_CF_COOKIEVALUE, verify=verify, stream=True, headers=headers)
|
r = scraper.get(url, params=payload, cookies=mylar.WWT_CF_COOKIEVALUE, verify=verify, stream=True, headers=headers)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -9,29 +9,39 @@ class TorrentClient(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.conn = None
|
self.conn = None
|
||||||
|
|
||||||
def connect(self, host, username, password):
|
def connect(self, host, username, password, test=False):
|
||||||
if self.conn is not None:
|
if self.conn is not None:
|
||||||
return self.connect
|
return self.connect
|
||||||
|
|
||||||
if not host:
|
if not host:
|
||||||
return False
|
return {'status': False, 'error': 'No host specified'}
|
||||||
|
|
||||||
|
if not username:
|
||||||
|
return {'status': False, 'error': 'No username specified'}
|
||||||
|
|
||||||
|
if not password:
|
||||||
|
return {'status': False, 'error': 'No password specified'}
|
||||||
|
|
||||||
# Get port from the config
|
# Get port from the config
|
||||||
host,portnr = host.split(':')
|
host,portnr = host.split(':')
|
||||||
|
|
||||||
|
|
||||||
#if username and password:
|
|
||||||
# logger.info('Connecting to ' + host + ':' + portnr + ' Username: ' + username + ' Password: ' + password )
|
# logger.info('Connecting to ' + host + ':' + portnr + ' Username: ' + username + ' Password: ' + password )
|
||||||
try:
|
try:
|
||||||
self.client = DelugeRPCClient(host,int(portnr),username,password)
|
self.client = DelugeRPCClient(host,int(portnr),username,password)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('Could not create DelugeRPCClient Object' + e)
|
logger.error('Could not create DelugeRPCClient Object %s' % e)
|
||||||
return False
|
return {'status': False, 'error': e}
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
self.client.connect()
|
self.client.connect()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('Could not connect to Deluge ' + host)
|
logger.error('Could not connect to Deluge: %s' % host)
|
||||||
|
return {'status': False, 'error': e}
|
||||||
|
else:
|
||||||
|
if test is True:
|
||||||
|
daemon_version = self.client.call('daemon.info')
|
||||||
|
libtorrent_version = self.client.call('core.get_libtorrent_version')
|
||||||
|
return {'status': True, 'daemon_version': daemon_version, 'libtorrent_version': libtorrent_version}
|
||||||
else:
|
else:
|
||||||
return self.client
|
return self.client
|
||||||
|
|
||||||
|
|
|
@ -5959,13 +5959,29 @@ class WebInterface(object):
|
||||||
return 'Error establishing connection to Qbittorrent'
|
return 'Error establishing connection to Qbittorrent'
|
||||||
else:
|
else:
|
||||||
if qclient['status'] is False:
|
if qclient['status'] is False:
|
||||||
logger.warn('[qBittorrent] Could not establish connection to %s. Error returned:' % (host, qclient['error']))
|
logger.warn('[qBittorrent] Could not establish connection to %s. Error returned: %s' % (host, qclient['error']))
|
||||||
return 'Error establishing connection to Qbittorrent'
|
return 'Error establishing connection to Qbittorrent'
|
||||||
else:
|
else:
|
||||||
logger.info('[qBittorrent] Successfully validated connection to %s [%s]' % (host, qclient['version']))
|
logger.info('[qBittorrent] Successfully validated connection to %s [v%s]' % (host, qclient['version']))
|
||||||
return 'Successfully validated qBittorrent connection'
|
return 'Successfully validated qBittorrent connection'
|
||||||
testqbit.exposed = True
|
testqbit.exposed = True
|
||||||
|
|
||||||
|
def testdeluge(self, host, username, password):
|
||||||
|
import torrent.clients.deluge as DelugeClient
|
||||||
|
client = DelugeClient.TorrentClient()
|
||||||
|
dclient = client.connect(host, username, password, True)
|
||||||
|
if not dclient:
|
||||||
|
logger.warn('[Deluge] Could not establish connection to %s' % host)
|
||||||
|
return 'Error establishing connection to Deluge'
|
||||||
|
else:
|
||||||
|
if dclient['status'] is False:
|
||||||
|
logger.warn('[Deluge] Could not establish connection to %s. Error returned: %s' % (host, dclient['error']))
|
||||||
|
return 'Error establishing connection to Deluge'
|
||||||
|
else:
|
||||||
|
logger.info('[Deluge] Successfully validated connection to %s [daemon v%s; libtorrent v%s]' % (host, dclient['daemon_version'], dclient['libtorrent_version']))
|
||||||
|
return 'Successfully validated Deluge connection'
|
||||||
|
testdeluge.exposed = True
|
||||||
|
|
||||||
def testnewznab(self, name, host, ssl, apikey):
|
def testnewznab(self, name, host, ssl, apikey):
|
||||||
logger.fdebug('ssl/verify: %s' % ssl)
|
logger.fdebug('ssl/verify: %s' % ssl)
|
||||||
if 'ssl' == '0' or ssl == '1':
|
if 'ssl' == '0' or ssl == '1':
|
||||||
|
|
Loading…
Reference in New Issue