deluge-api
v0.3.0
Published
Deluge API wrapper
Downloads
1
Readme
#Deluge API
This package is a wrapper around the Deluge web client JSON RPC API.
Full docs on what the list of JSON RPC commands are is hard to come by so you probably just want to inspect what the web UI is using.
##Example:
var deluge = new DelugeApi({
host: 'deluge.example.com',
port: 80
});
deluge.getSystemMethods()
.then((system) => {
return system.auth.check_session()
.then((authed) => {
if (!authed) {
return new Promise((resolve, reject) => {
system.auth.login([process.env.DELUGE_PASSWORD])
.then((authed) => {
if (authed) {
resolve();
} else {
reject('Invalid password');
}
}).catch(reject);
})
return Promise.resolve();
}
})
.then(() => {
return system.daemon.info();
})
.then((daemonVersion) => {
console.log('daemonInfo: ' + daemonVersion);
});
}).catch((err) => {
console.log(err);
console.log('Errors: ' + JSON.stringify(err));
});