forked from LBRYCommunity/lbry-sdk
Merge pull request #21 from lbryio/detect-if-daemon-is-running
check if daemon is running before starting console
This commit is contained in:
commit
053681e4a5
2 changed files with 106 additions and 85 deletions
|
@ -5,8 +5,14 @@ import argparse
|
||||||
import requests
|
import requests
|
||||||
import locale
|
import locale
|
||||||
import sys
|
import sys
|
||||||
|
import webbrowser
|
||||||
|
|
||||||
|
from xmlrpclib import ServerProxy
|
||||||
from yapsy.PluginManager import PluginManager
|
from yapsy.PluginManager import PluginManager
|
||||||
from twisted.internet import defer, threads, stdio, task, error
|
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.ConsoleControl import ConsoleControl
|
||||||
from lbrynet.lbrynet_console.LBRYSettings import LBRYSettings
|
from lbrynet.lbrynet_console.LBRYSettings import LBRYSettings
|
||||||
from lbrynet.lbryfilemanager.LBRYFileManager import LBRYFileManager
|
from lbrynet.lbryfilemanager.LBRYFileManager import LBRYFileManager
|
||||||
|
@ -461,7 +467,19 @@ class LBRYConsole():
|
||||||
|
|
||||||
|
|
||||||
def launch_lbry_console():
|
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
|
from twisted.internet import reactor
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="Launch a lbrynet console")
|
parser = argparse.ArgumentParser(description="Launch a lbrynet console")
|
||||||
|
|
|
@ -152,6 +152,9 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
||||||
d.addCallback(lambda _: self._setup_lbry_file_opener())
|
d.addCallback(lambda _: self._setup_lbry_file_opener())
|
||||||
d.addCallback(lambda _: self._setup_query_handlers())
|
d.addCallback(lambda _: self._setup_query_handlers())
|
||||||
d.addCallback(lambda _: self._setup_server())
|
d.addCallback(lambda _: self._setup_server())
|
||||||
|
# if sys.platform == "darwin":
|
||||||
|
# d.addCallback(lambda _: self._update())
|
||||||
|
# d.addCallback(lambda _: self.status_app.run())
|
||||||
# d.addCallback(lambda _: self._update() if self.check_for_updates == "True" and sys.platform == "darwin"
|
# d.addCallback(lambda _: self._update() if self.check_for_updates == "True" and sys.platform == "darwin"
|
||||||
# else defer.succeed(None))
|
# else defer.succeed(None))
|
||||||
d.addCallback(lambda _: self._setup_fetcher())
|
d.addCallback(lambda _: self._setup_fetcher())
|
||||||
|
|
Loading…
Reference in a new issue