diff --git a/lbrynet/extras/cli.py b/lbrynet/extras/cli.py index 5479cdfc0..9e83f419a 100644 --- a/lbrynet/extras/cli.py +++ b/lbrynet/extras/cli.py @@ -144,6 +144,8 @@ def get_argument_parser(): for group in sorted(api): group_command = sub.add_parser(group, help=api[group]['doc']) group_command.set_defaults(group_doc=group_command) + if group in ('status', 'publish', 'version', 'help', 'wallet_balance', 'get'): + continue commands = group_command.add_subparsers(dest='subcommand') for command in api[group]['commands']: commands.add_parser(command['name'], help=command['doc'].strip().splitlines()[0]) @@ -165,10 +167,8 @@ def main(argv=None): return 0 elif args.command == 'start': - console_output = True - verbose = True - log_support.configure_logging(conf.log_file_path, console_output, verbose) + log_support.configure_logging(conf.log_file_path, not args.quiet, args.verbose) if conf.share_usage_data: loggly_handler = get_loggly_handler() @@ -204,10 +204,10 @@ def main(argv=None): elif args.command is not None: - if args.subcommand is not None: - method = f'{args.command}_{args.subcommand}' - elif args.command in ('status', 'publish', 'version', 'help', 'wallet_balance'): + if args.command in ('status', 'publish', 'version', 'help', 'wallet_balance', 'get'): method = args.command + elif args.subcommand is not None: + method = f'{args.command}_{args.subcommand}' else: args.group_doc.print_help() return 0 diff --git a/lbrynet/extras/daemon/Daemon.py b/lbrynet/extras/daemon/Daemon.py index 28309076b..9ad7d5cdc 100644 --- a/lbrynet/extras/daemon/Daemon.py +++ b/lbrynet/extras/daemon/Daemon.py @@ -797,7 +797,7 @@ class Daemon(metaclass=JSONRPCServerType): if blob: return self.blob_manager.get_blob(blob[0]) return await d2f(download_sd_blob( - sd_hash.decode(), self.blob_manager, self.component_manager.peer_finder, self.rate_limiter, + self.conf, sd_hash.decode(), self.blob_manager, self.component_manager.peer_finder, self.rate_limiter, self.payment_rate_manager, self.wallet_manager, timeout=self.conf.peer_search_timeout, download_mirrors=self.conf.download_mirrors )) diff --git a/lbrynet/extras/daemon/Downloader.py b/lbrynet/extras/daemon/Downloader.py index cc9c20f7d..129cc5f4c 100644 --- a/lbrynet/extras/daemon/Downloader.py +++ b/lbrynet/extras/daemon/Downloader.py @@ -154,7 +154,7 @@ class GetStream: @defer.inlineCallbacks def _download_sd_blob(self): sd_blob = yield download_sd_blob( - self.sd_hash, self.blob_manager, self.peer_finder, self.rate_limiter, self.payment_rate_manager, + self.conf, self.sd_hash, self.blob_manager, self.peer_finder, self.rate_limiter, self.payment_rate_manager, self.wallet, self.timeout, self.conf.download_mirrors ) defer.returnValue(sd_blob) diff --git a/lbrynet/extras/wallet/manager.py b/lbrynet/extras/wallet/manager.py index 559a63f44..f4b35c65d 100644 --- a/lbrynet/extras/wallet/manager.py +++ b/lbrynet/extras/wallet/manager.py @@ -166,14 +166,12 @@ class LbryWalletManager(BaseWalletManager): 'lbrycrd_main': 'lbc_mainnet', 'lbrycrd_testnet': 'lbc_testnet', 'lbrycrd_regtest': 'lbc_regtest' - }[settings['blockchain_name']] + }[settings.blockchain_name] ledger_config = { 'auto_connect': True, - 'default_servers': settings['lbryum_servers'], + 'default_servers': settings.lbryum_servers, 'data_path': settings.wallet_dir, - 'use_keyring': settings['use_keyring'], - #'db': db } wallets_directory = os.path.join(settings.wallet_dir, 'wallets') diff --git a/lbrynet/p2p/HTTPBlobDownloader.py b/lbrynet/p2p/HTTPBlobDownloader.py index 405dec7f3..b7941e52a 100644 --- a/lbrynet/p2p/HTTPBlobDownloader.py +++ b/lbrynet/p2p/HTTPBlobDownloader.py @@ -157,7 +157,7 @@ class HTTPBlobDownloader: @defer.inlineCallbacks def _write_blob(self, writer, blob): - response = yield self.client.get(url_for(choice(self.servers), blob.blob_hash)) + response = yield self.client.get(url_for('{}:{}'.format(*choice(self.servers)), blob.blob_hash)) if response.code != 200: log.debug('Missing a blob: %s', blob.blob_hash) if blob.blob_hash in self.blob_hashes: diff --git a/lbrynet/p2p/StreamDescriptor.py b/lbrynet/p2p/StreamDescriptor.py index b63a179d3..3ee09784b 100644 --- a/lbrynet/p2p/StreamDescriptor.py +++ b/lbrynet/p2p/StreamDescriptor.py @@ -429,7 +429,7 @@ class EncryptedFileStreamDescriptorValidator: @defer.inlineCallbacks -def download_sd_blob(blob_hash, blob_manager, peer_finder, rate_limiter, payment_rate_manager, wallet, timeout=None, +def download_sd_blob(conf, blob_hash, blob_manager, peer_finder, rate_limiter, payment_rate_manager, wallet, timeout=None, download_mirrors=None): """ Downloads a single blob from the network @@ -443,7 +443,8 @@ def download_sd_blob(blob_hash, blob_manager, peer_finder, rate_limiter, payment @return: An object of type HashBlob """ - downloader = StandaloneBlobDownloader(blob_hash, + downloader = StandaloneBlobDownloader(conf, + blob_hash, blob_manager, peer_finder, rate_limiter, diff --git a/tests/functional/test_misc.py b/tests/functional/test_misc.py index bbe880bdb..f21af0c4f 100644 --- a/tests/functional/test_misc.py +++ b/tests/functional/test_misc.py @@ -155,7 +155,7 @@ class TestTransfer(unittest.TestCase): @defer.inlineCallbacks def test_lbry_transfer(self): sd_blob = yield download_sd_blob( - self.sd_hash, self.blob_manager, self.peer_finder, self.rate_limiter, self.prm, self.wallet + self.conf, self.sd_hash, self.blob_manager, self.peer_finder, self.rate_limiter, self.prm, self.wallet ) metadata = yield self.sd_identifier.get_metadata_for_sd_blob(sd_blob) downloader = yield metadata.factories[0].make_downloader(