fixed after testing with desktop app

This commit is contained in:
Lex Berezhny 2019-01-22 16:32:12 -05:00
parent 19b0d59159
commit 6606deafa5
7 changed files with 15 additions and 16 deletions

View file

@ -144,6 +144,8 @@ def get_argument_parser():
for group in sorted(api): for group in sorted(api):
group_command = sub.add_parser(group, help=api[group]['doc']) group_command = sub.add_parser(group, help=api[group]['doc'])
group_command.set_defaults(group_doc=group_command) 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') commands = group_command.add_subparsers(dest='subcommand')
for command in api[group]['commands']: for command in api[group]['commands']:
commands.add_parser(command['name'], help=command['doc'].strip().splitlines()[0]) commands.add_parser(command['name'], help=command['doc'].strip().splitlines()[0])
@ -165,10 +167,8 @@ def main(argv=None):
return 0 return 0
elif args.command == 'start': 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: if conf.share_usage_data:
loggly_handler = get_loggly_handler() loggly_handler = get_loggly_handler()
@ -204,10 +204,10 @@ def main(argv=None):
elif args.command is not None: elif args.command is not None:
if args.subcommand is not None: if args.command in ('status', 'publish', 'version', 'help', 'wallet_balance', 'get'):
method = f'{args.command}_{args.subcommand}'
elif args.command in ('status', 'publish', 'version', 'help', 'wallet_balance'):
method = args.command method = args.command
elif args.subcommand is not None:
method = f'{args.command}_{args.subcommand}'
else: else:
args.group_doc.print_help() args.group_doc.print_help()
return 0 return 0

View file

@ -797,7 +797,7 @@ class Daemon(metaclass=JSONRPCServerType):
if blob: if blob:
return self.blob_manager.get_blob(blob[0]) return self.blob_manager.get_blob(blob[0])
return await d2f(download_sd_blob( 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, self.payment_rate_manager, self.wallet_manager, timeout=self.conf.peer_search_timeout,
download_mirrors=self.conf.download_mirrors download_mirrors=self.conf.download_mirrors
)) ))

View file

@ -154,7 +154,7 @@ class GetStream:
@defer.inlineCallbacks @defer.inlineCallbacks
def _download_sd_blob(self): def _download_sd_blob(self):
sd_blob = yield download_sd_blob( 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 self.wallet, self.timeout, self.conf.download_mirrors
) )
defer.returnValue(sd_blob) defer.returnValue(sd_blob)

View file

@ -166,14 +166,12 @@ class LbryWalletManager(BaseWalletManager):
'lbrycrd_main': 'lbc_mainnet', 'lbrycrd_main': 'lbc_mainnet',
'lbrycrd_testnet': 'lbc_testnet', 'lbrycrd_testnet': 'lbc_testnet',
'lbrycrd_regtest': 'lbc_regtest' 'lbrycrd_regtest': 'lbc_regtest'
}[settings['blockchain_name']] }[settings.blockchain_name]
ledger_config = { ledger_config = {
'auto_connect': True, 'auto_connect': True,
'default_servers': settings['lbryum_servers'], 'default_servers': settings.lbryum_servers,
'data_path': settings.wallet_dir, 'data_path': settings.wallet_dir,
'use_keyring': settings['use_keyring'],
#'db': db
} }
wallets_directory = os.path.join(settings.wallet_dir, 'wallets') wallets_directory = os.path.join(settings.wallet_dir, 'wallets')

View file

@ -157,7 +157,7 @@ class HTTPBlobDownloader:
@defer.inlineCallbacks @defer.inlineCallbacks
def _write_blob(self, writer, blob): 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: if response.code != 200:
log.debug('Missing a blob: %s', blob.blob_hash) log.debug('Missing a blob: %s', blob.blob_hash)
if blob.blob_hash in self.blob_hashes: if blob.blob_hash in self.blob_hashes:

View file

@ -429,7 +429,7 @@ class EncryptedFileStreamDescriptorValidator:
@defer.inlineCallbacks @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): download_mirrors=None):
""" """
Downloads a single blob from the network 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 @return: An object of type HashBlob
""" """
downloader = StandaloneBlobDownloader(blob_hash, downloader = StandaloneBlobDownloader(conf,
blob_hash,
blob_manager, blob_manager,
peer_finder, peer_finder,
rate_limiter, rate_limiter,

View file

@ -155,7 +155,7 @@ class TestTransfer(unittest.TestCase):
@defer.inlineCallbacks @defer.inlineCallbacks
def test_lbry_transfer(self): def test_lbry_transfer(self):
sd_blob = yield download_sd_blob( 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) metadata = yield self.sd_identifier.get_metadata_for_sd_blob(sd_blob)
downloader = yield metadata.factories[0].make_downloader( downloader = yield metadata.factories[0].make_downloader(