forked from LBRYCommunity/lbry-sdk
ability to overide the file name, hash and size when updating a stream claim
This commit is contained in:
parent
a782adea75
commit
3357a419ab
3 changed files with 19 additions and 0 deletions
|
@ -2231,6 +2231,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
stream_update (<claim_id> | --claim_id=<claim_id>) [--bid=<bid>] [--file_path=<file_path>]
|
stream_update (<claim_id> | --claim_id=<claim_id>) [--bid=<bid>] [--file_path=<file_path>]
|
||||||
|
[--file_name=<file_name>] [--file_size=<file_size>] [--file_hash=<file_hash>]
|
||||||
[--tags=<tags>...] [--clear_tags]
|
[--tags=<tags>...] [--clear_tags]
|
||||||
[--languages=<languages>...] [--clear_languages]
|
[--languages=<languages>...] [--clear_languages]
|
||||||
[--locations=<locations>...] [--clear_locations]
|
[--locations=<locations>...] [--clear_locations]
|
||||||
|
@ -2246,6 +2247,9 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
--claim_id=<claim_id> : (str) id of the stream claim to update
|
--claim_id=<claim_id> : (str) id of the stream claim to update
|
||||||
--bid=<bid> : (decimal) amount to back the claim
|
--bid=<bid> : (decimal) amount to back the claim
|
||||||
--file_path=<file_path> : (str) path to file to be associated with name.
|
--file_path=<file_path> : (str) path to file to be associated with name.
|
||||||
|
--file_name=<file_name> : (str) override file name, defaults to name from file_path.
|
||||||
|
--file_size=<file_size> : (str) override file size, otherwise automatically computed.
|
||||||
|
--file_hash=<file_hash> : (str) override file hash, otherwise automatically computed.
|
||||||
--fee_currency=<fee_currency> : (string) specify fee currency
|
--fee_currency=<fee_currency> : (string) specify fee currency
|
||||||
--fee_amount=<fee_amount> : (decimal) content download fee
|
--fee_amount=<fee_amount> : (decimal) content download fee
|
||||||
--fee_address=<fee_address> : (str) address where to send fee payments, will use
|
--fee_address=<fee_address> : (str) address where to send fee payments, will use
|
||||||
|
|
|
@ -212,6 +212,12 @@ class Stream(BaseClaim):
|
||||||
|
|
||||||
if 'sd_hash' in kwargs:
|
if 'sd_hash' in kwargs:
|
||||||
self.source.sd_hash = kwargs.pop('sd_hash')
|
self.source.sd_hash = kwargs.pop('sd_hash')
|
||||||
|
if 'file_size' in kwargs:
|
||||||
|
self.source.size = kwargs.pop('file_size')
|
||||||
|
if 'file_name' in kwargs:
|
||||||
|
self.source.name = kwargs.pop('file_name')
|
||||||
|
if 'file_hash' in kwargs:
|
||||||
|
self.source.file_hash = kwargs.pop('file_hash')
|
||||||
|
|
||||||
stream_type = None
|
stream_type = None
|
||||||
if file_path is not None:
|
if file_path is not None:
|
||||||
|
|
|
@ -358,6 +358,15 @@ class StreamCommands(CommandTestCase):
|
||||||
fixed_values['locations'] = [{'country': 'BR'}]
|
fixed_values['locations'] = [{'country': 'BR'}]
|
||||||
self.assertEqual(txo['value'], fixed_values)
|
self.assertEqual(txo['value'], fixed_values)
|
||||||
|
|
||||||
|
# modifying hash/size/name
|
||||||
|
fixed_values['source']['name'] = 'changed_name'
|
||||||
|
fixed_values['source']['hash'] = 'cafebeef'
|
||||||
|
fixed_values['source']['size'] = '42'
|
||||||
|
tx = await self.out(self.stream_update(
|
||||||
|
claim_id, file_name='changed_name', file_hash='cafebeef', file_size=42
|
||||||
|
))
|
||||||
|
self.assertEqual(tx['outputs'][0]['value'], fixed_values)
|
||||||
|
|
||||||
# send claim to someone else
|
# send claim to someone else
|
||||||
new_account = await self.out(self.daemon.jsonrpc_account_create('second account'))
|
new_account = await self.out(self.daemon.jsonrpc_account_create('second account'))
|
||||||
account2_id, account2 = new_account['id'], self.daemon.get_account_or_error(new_account['id'])
|
account2_id, account2 = new_account['id'], self.daemon.get_account_or_error(new_account['id'])
|
||||||
|
|
Loading…
Reference in a new issue