forked from LBRYCommunity/lbry-sdk
Update daemon and uri handler
Add command to stop daemon from the terminal If lbrynet-daemon isn’t running the uri handler will now redirect to lbry.io/get
This commit is contained in:
parent
e144b26619
commit
1e73b2437d
3 changed files with 31 additions and 3 deletions
21
lbrynet/lbrynet_daemon/LBRYDaemonStopper.py
Normal file
21
lbrynet/lbrynet_daemon/LBRYDaemonStopper.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
import xmlrpclib
|
||||
|
||||
|
||||
def main():
|
||||
daemon = xmlrpclib.ServerProxy("http://localhost:7080/")
|
||||
try:
|
||||
b = daemon.get_balance()
|
||||
is_running = True
|
||||
except:
|
||||
is_running = False
|
||||
|
||||
if is_running:
|
||||
try:
|
||||
daemon.stop()
|
||||
except:
|
||||
print "LBRYnet daemon stopped"
|
||||
else:
|
||||
print "LBRYnet daemon wasn't running"
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -15,11 +15,17 @@ def main(args):
|
|||
|
||||
daemon = xmlrpclib.ServerProxy('http://localhost:7080/')
|
||||
|
||||
try:
|
||||
b = daemon.get_balance()
|
||||
is_running = True
|
||||
except:
|
||||
webbrowser.open('http://lbry.io/get')
|
||||
is_running = False
|
||||
|
||||
if len(args) > 1:
|
||||
print 'Too many args', args
|
||||
|
||||
else:
|
||||
|
||||
elif is_running:
|
||||
if args[0][7:] == 'lbry':
|
||||
daemon.render_gui()
|
||||
|
||||
|
|
3
setup.py
3
setup.py
|
@ -22,6 +22,7 @@ setup(name='lbrynet',
|
|||
'lbrynet-lookup-hosts-for-hash = lbrynet.dht_scripts:get_hosts_for_hash_in_dht',
|
||||
'lbrynet-announce_hash_to_dht = lbrynet.dht_scripts:announce_hash_to_dht',
|
||||
'lbrynet-daemon = lbrynet.lbrynet_daemon.LBRYDaemon:main',
|
||||
'stop-lbrynet-daemon = lbrynet.lbrynet_daemon.LBRYDaemonStopper:main',
|
||||
]
|
||||
},
|
||||
data_files=[
|
||||
|
@ -43,4 +44,4 @@ setup(name='lbrynet',
|
|||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
Loading…
Reference in a new issue