From 094d9c6497a3846e0c3781410406a3b4ba008066 Mon Sep 17 00:00:00 2001 From: hackrush Date: Tue, 24 Jul 2018 12:36:42 -0400 Subject: [PATCH] update lbrynet-cli --- lbrynet/daemon/DaemonCLI.py | 36 +++++++----------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/lbrynet/daemon/DaemonCLI.py b/lbrynet/daemon/DaemonCLI.py index 7ec03aa34..3cecc7c42 100644 --- a/lbrynet/daemon/DaemonCLI.py +++ b/lbrynet/daemon/DaemonCLI.py @@ -7,7 +7,7 @@ from collections import OrderedDict from lbrynet import conf from lbrynet.core import utils from lbrynet.daemon.auth.client import JSONRPCException, LBRYAPIClient, AuthAPIClient -from lbrynet.daemon.Daemon import LOADING_WALLET_CODE, Daemon +from lbrynet.daemon.Daemon import Daemon from lbrynet.core.system_info import get_platform from jsonrpc.common import RPCError from requests.exceptions import ConnectionError @@ -21,17 +21,13 @@ def remove_brackets(key): return key -def set_flag_vals(flag_names, parsed_args): +def set_kwargs(parsed_args): kwargs = OrderedDict() for key, arg in parsed_args.iteritems(): if arg is None: continue - elif key.startswith("--"): - if remove_brackets(key[2:]) not in kwargs: - k = remove_brackets(key[2:]) - elif key in flag_names: - if remove_brackets(flag_names[key]) not in kwargs: - k = remove_brackets(flag_names[key]) + elif key.startswith("--") and remove_brackets(key[2:]) not in kwargs: + k = remove_brackets(key[2:]) elif remove_brackets(key) not in kwargs: k = remove_brackets(key) kwargs[k] = guess_type(arg, k) @@ -79,26 +75,22 @@ def main(): method = new_method fn = Daemon.callable_methods[method] - if hasattr(fn, "_flags"): - flag_names = fn._flags - else: - flag_names = {} parsed = docopt(fn.__doc__, args) - kwargs = set_flag_vals(flag_names, parsed) + kwargs = set_kwargs(parsed) colorama.init() conf.initialize_settings() try: api = LBRYAPIClient.get_client() - status = api.status() + api.status() except (URLError, ConnectionError) as err: if isinstance(err, HTTPError) and err.code == UNAUTHORIZED: api = AuthAPIClient.config() # this can happen if the daemon is using auth with the --http-auth flag # when the config setting is to not use it try: - status = api.status() + api.status() except: print_error("Daemon requires authentication, but none was provided.", suggest_help=False) @@ -108,20 +100,6 @@ def main(): suggest_help=False) return 1 - status_code = status['startup_status']['code'] - - if status_code != "started" and method not in Daemon.allowed_during_startup: - print "Daemon is in the process of starting. Please try again in a bit." - message = status['startup_status']['message'] - if message: - if ( - status['startup_status']['code'] == LOADING_WALLET_CODE - and status['blockchain_status']['blocks_behind'] > 0 - ): - message += '. Blocks left: ' + str(status['blockchain_status']['blocks_behind']) - print " Status: " + message - return 1 - # TODO: check if port is bound. Error if its not try: