Merge pull request #658 from lbryio/publish-fixes

Publish fixes
This commit is contained in:
Jack Robison 2017-05-30 11:20:51 -04:00 committed by GitHub
commit 30185d2548
2 changed files with 20 additions and 23 deletions

View file

@ -13,12 +13,15 @@ at anytime.
* *
### Changed ### Changed
* * Update `publish` to use {'currency': ..., 'address': ..., 'amount'} format for fee parameter,
previously used old {currency: {'address': ..., 'amount': ...}} format
* *
### Fixed ### Fixed
* *
* *
* Allow claim_show to be used without specifying name
* Fix licenseUrl field in `publish`
### Deprecated ### Deprecated
* *

View file

@ -1804,7 +1804,7 @@ class Daemon(AuthJSONRPCServer):
if bid <= 0.0: if bid <= 0.0:
raise Exception("Invalid bid") raise Exception("Invalid bid")
if bid > self.session.wallet.get_balance(): if bid >= self.session.wallet.get_balance():
raise InsufficientFundsError() raise InsufficientFundsError()
metadata = metadata or {} metadata = metadata or {}
@ -1821,7 +1821,7 @@ class Daemon(AuthJSONRPCServer):
if license is not None: if license is not None:
metadata['license'] = license metadata['license'] = license
if license_url is not None: if license_url is not None:
metadata['license_url'] = license_url metadata['licenseUrl'] = license_url
if thumbnail is not None: if thumbnail is not None:
metadata['thumbnail'] = thumbnail metadata['thumbnail'] = thumbnail
if preview is not None: if preview is not None:
@ -1834,26 +1834,13 @@ class Daemon(AuthJSONRPCServer):
# original format {'currency':{'address','amount'}} # original format {'currency':{'address','amount'}}
# add address to fee if unspecified {'version': ,'currency', 'address' , 'amount'} # add address to fee if unspecified {'version': ,'currency', 'address' , 'amount'}
if 'fee' in metadata: if 'fee' in metadata:
assert len(metadata['fee']) == 1, "Too many fees" if 'amount' in metadata['fee'] and 'currency' in metadata['fee']:
currency, fee_dict = metadata['fee'].items()[0] if not metadata['fee']['amount']:
if 'address' not in fee_dict: log.warning("Stripping empty fee from published metadata")
address = yield self.session.wallet.get_new_address() del metadata['fee']
else: elif 'address' not in metadata['fee']:
address = fee_dict['address'] address = yield self.session.wallet.get_unused_address()
metadata['fee'] = { metadata['fee']['address'] = address
'version': '_0_0_1',
'currency': currency,
'address': address,
'amount': fee_dict['amount']
}
log.info("Publish: %s", {
'name': name,
'file_path': file_path,
'bid': bid,
'metadata': metadata,
'fee': fee,
})
claim_dict = { claim_dict = {
'version': '_0_0_1', 'version': '_0_0_1',
@ -1867,6 +1854,13 @@ class Daemon(AuthJSONRPCServer):
if sources is not None: if sources is not None:
claim_dict['stream']['source'] = sources claim_dict['stream']['source'] = sources
log.info("Publish: %s", {
'name': name,
'file_path': file_path,
'bid': bid,
'claim_dict': claim_dict,
})
if channel_id: if channel_id:
certificate_id = channel_id certificate_id = channel_id
elif channel_name: elif channel_name: