def run(self, rpc_port=DEFAULT_RPC_PORT, other_params=''): cmd = ('aria2c ' ' --enable-rpc' ' --continue=true' ' --rpc-listen-port={}' ' --rpc-listen-all=true' ' --daemon=true' ' {}').format(rpc_port, other_params) if self.secret: cmd = '{} --rpc-secret {}'.format(cmd, self.secret) result, error = yield sub.call_subprocess(cmd) raise gen.Return(False if error else True)
def kill(self): '''Kill aria2 process''' result, error = yield sub.call_subprocess('killall aria2c') raise gen.Return(False if error else True)