forked from LBRYCommunity/lbry-sdk
check if daemon is running before starting console
This commit is contained in:
parent
a98c760d93
commit
7756d12993
2 changed files with 107 additions and 92 deletions
|
@ -5,9 +5,13 @@ import argparse
|
|||
import requests
|
||||
import locale
|
||||
import sys
|
||||
import webbrowser
|
||||
|
||||
from xmlrpclib import ServerProxy
|
||||
from yapsy.PluginManager import PluginManager
|
||||
from twisted.internet import defer, threads, stdio, task, error
|
||||
from twisted.python.failure import Failure
|
||||
|
||||
# from lbrynet.core.client.AutoDownloader import AutoFetcher
|
||||
from lbrynet.lbrynet_console.ConsoleControl import ConsoleControl
|
||||
from lbrynet.lbrynet_console.LBRYSettings import LBRYSettings
|
||||
|
@ -508,7 +512,19 @@ class LBRYConsole():
|
|||
|
||||
|
||||
def launch_lbry_console():
|
||||
try:
|
||||
daemon = ServerProxy("http://localhost:7080")
|
||||
daemon.is_running()
|
||||
|
||||
print "lbrynet-daemon is already running"
|
||||
print "To use lbrynet-console first close the LBRY status bar app, " \
|
||||
"or run stop-lbrynet-daemon if you started it via command line"
|
||||
print ""
|
||||
print "Launching browser interface"
|
||||
|
||||
webbrowser.open("lbry://lbry")
|
||||
|
||||
except:
|
||||
from twisted.internet import reactor
|
||||
|
||||
parser = argparse.ArgumentParser(description="Launch a lbrynet console")
|
||||
|
@ -588,7 +604,6 @@ def launch_lbry_console():
|
|||
os.mkdir(data_dir)
|
||||
created_data_dir = True
|
||||
|
||||
|
||||
log_format = "(%(asctime)s)[%(filename)s:%(lineno)s] %(funcName)s(): %(message)s"
|
||||
formatter = logging.Formatter(log_format)
|
||||
|
||||
|
|
|
@ -133,8 +133,8 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
d.addCallback(lambda _: self._setup_lbry_file_opener())
|
||||
d.addCallback(lambda _: self._setup_query_handlers())
|
||||
d.addCallback(lambda _: self._setup_server())
|
||||
if sys.platform == "darwin":
|
||||
d.addCallback(lambda _: self._update())
|
||||
# if sys.platform == "darwin":
|
||||
# d.addCallback(lambda _: self._update())
|
||||
# d.addCallback(lambda _: self.status_app.run())
|
||||
d.addCallback(lambda _: self._setup_fetcher())
|
||||
d.addCallback(lambda _: _disp_startup())
|
||||
|
|
Loading…
Reference in a new issue