forked from LBRYCommunity/lbry-sdk
don't log to console, add --no-launch flag, fix help()
by default, the ui opens in the lbrynet-daemon startup sequence, the —no-launch flag stops the ui from launching
This commit is contained in:
parent
9a26d869fe
commit
b3b5581f2d
2 changed files with 16 additions and 14 deletions
|
@ -61,6 +61,7 @@ LOG_FILENAME = os.path.join(log_dir, 'lbrynet-daemon.log')
|
|||
log = logging.getLogger(__name__)
|
||||
handler = logging.handlers.RotatingFileHandler(LOG_FILENAME, maxBytes=262144, backupCount=5)
|
||||
log.addHandler(handler)
|
||||
log.setLevel(logging.INFO)
|
||||
|
||||
STARTUP_STAGES = [
|
||||
('initializing', 'Initializing...'),
|
||||
|
@ -1078,12 +1079,7 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
|||
"""
|
||||
|
||||
if not p:
|
||||
return self._render_response(['is_running', 'get_settings', 'set_settings', 'start_fetcher', 'stop_fetcher',
|
||||
'fetcher_status', 'get_balance', 'stop', 'get_lbry_files', 'resolve_name',
|
||||
'get', 'search_nametrie', 'delete_lbry_file', 'check', 'publish',
|
||||
'abandon_name', 'get_name_claims', 'get_time_behind_blockchain',
|
||||
'get_new_address', 'toggle_fetcher_verbose', 'check_for_new_version'],
|
||||
OK_CODE)
|
||||
return self._render_response(self._listFunctions(), OK_CODE)
|
||||
elif 'callable_during_start' in p.keys():
|
||||
return self._render_response(ALLOWED_DURING_STARTUP, OK_CODE)
|
||||
elif 'function' in p.keys():
|
||||
|
|
|
@ -8,7 +8,6 @@ import webbrowser
|
|||
import sys
|
||||
import socket
|
||||
|
||||
|
||||
from StringIO import StringIO
|
||||
from zipfile import ZipFile
|
||||
from urllib import urlopen
|
||||
|
@ -30,14 +29,14 @@ if not os.path.isdir(log_dir):
|
|||
os.mkdir(log_dir)
|
||||
|
||||
LOG_FILENAME = os.path.join(log_dir, 'lbrynet-daemon.log')
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
handler = logging.handlers.RotatingFileHandler(LOG_FILENAME, maxBytes=262144, backupCount=5)
|
||||
log.addHandler(handler)
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
log.setLevel(logging.INFO)
|
||||
|
||||
REMOTE_SERVER = "www.google.com"
|
||||
|
||||
|
||||
def test_internet_connection():
|
||||
try:
|
||||
host = socket.gethostbyname(REMOTE_SERVER)
|
||||
|
@ -66,16 +65,14 @@ def start():
|
|||
help="lbrycrd or lbryum, default lbryum",
|
||||
type=str,
|
||||
default=DEFAULT_WALLET)
|
||||
parser.add_argument("--update",
|
||||
help="True or false, default true",
|
||||
type=str,
|
||||
default="True")
|
||||
parser.add_argument("--ui",
|
||||
help="path to custom UI folder",
|
||||
default="")
|
||||
parser.add_argument("--branch",
|
||||
help="Branch of lbry-web-ui repo to use, defaults on HEAD",
|
||||
default="HEAD")
|
||||
parser.add_argument('--no-launch', dest='launchui', action="store_false")
|
||||
parser.set_defaults(launchui=True)
|
||||
|
||||
try:
|
||||
JSONRPCProxy.from_url(API_CONNECTION_STRING).is_running()
|
||||
|
@ -85,6 +82,11 @@ def start():
|
|||
pass
|
||||
|
||||
log.info("Starting lbrynet-daemon from command line")
|
||||
print "Starting lbrynet-daemon from command line"
|
||||
print "To view activity, view the log file here: " + LOG_FILENAME
|
||||
print "Web UI is available at http://%s:%i" %(API_INTERFACE, API_PORT)
|
||||
print "JSONRPC API is available at " + API_CONNECTION_STRING
|
||||
print "To quit press ctrl-c or call 'stop' via the API"
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
@ -118,6 +120,7 @@ def start():
|
|||
git_version = subprocess.check_output(GIT_CMD_STRING, shell=True)
|
||||
if not git_version:
|
||||
log.info("You should have been notified to install xcode command line tools, once it's installed you can start LBRY")
|
||||
print "You should have been notified to install xcode command line tools, once it's installed you can start LBRY"
|
||||
sys.exit(0)
|
||||
|
||||
ui_version_info = git_version
|
||||
|
@ -165,8 +168,11 @@ def start():
|
|||
d = getui(args.ui)
|
||||
d.addCallback(lambda r: setupserver(r[0], r[1]))
|
||||
d.addCallback(lambda r: setupapi(r[0], args.wallet, r[1]))
|
||||
d.addCallback(lambda _: webbrowser.open(UI_ADDRESS))
|
||||
if args.launchui:
|
||||
d.addCallback(lambda _: webbrowser.open(UI_ADDRESS))
|
||||
reactor.run()
|
||||
print "\nClosing lbrynet-daemon"
|
||||
else:
|
||||
log.info("Not connected to internet, unable to start")
|
||||
print "Not connected to internet, unable to start"
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue