Merge branch 'master' of github.com:lbryio/lbry

This commit is contained in:
Jimmy Kiselak 2015-10-28 01:38:13 -04:00
commit 756c43c087

View file

@ -220,11 +220,25 @@ class LBRYConsole():
d = self.settings.save_lbryid(self.lbryid) d = self.settings.save_lbryid(self.lbryid)
return d return d
def _check_config_newlines(self, config_path):
f = open(config_path, 'r')
lines = [l for l in f]
f.close()
if lines[-1][-1] != "\n":
f = open(config_path, 'w')
for l in lines:
if l[-1] == "\n":
f.write(l)
else:
f.write(l + "\n")
f.close()
def _get_lbrycrd_settings(self): def _get_lbrycrd_settings(self):
settings = {"username": "rpcuser", settings = {"username": "rpcuser",
"password": "rpcpassword", "password": "rpcpassword",
"rpc_port": 8332} "rpc_port": 8332}
if os.path.exists(self.lbrycrd_conf): if os.path.exists(self.lbrycrd_conf):
self._check_config_newlines(self.lbrycrd_conf)
lbrycrd_conf = open(self.lbrycrd_conf) lbrycrd_conf = open(self.lbrycrd_conf)
for l in lbrycrd_conf: for l in lbrycrd_conf:
if l.startswith("rpcuser="): if l.startswith("rpcuser="):
@ -556,4 +570,4 @@ def launch_lbry_console():
d.addErrback(lambda _: reactor.stop()) d.addErrback(lambda _: reactor.stop())
reactor.addSystemEventTrigger('before', 'shutdown', console.shut_down) reactor.addSystemEventTrigger('before', 'shutdown', console.shut_down)
reactor.run() reactor.run()