ability to set sd_hash, file_name and file_hash when updating a stream claim

This commit is contained in:
Lex Berezhny 2021-04-14 19:15:33 -04:00
parent cc2852cd48
commit f8814881a1
2 changed files with 21 additions and 12 deletions

View file

@ -2996,13 +2996,13 @@ class Daemon(metaclass=JSONRPCServerType):
Usage: Usage:
publish (<name> | --name=<name>) [--bid=<bid>] [--file_path=<file_path>] publish (<name> | --name=<name>) [--bid=<bid>] [--file_path=<file_path>]
[--validate_file] [--optimize_file] [--file_name=<file_name>] [--file_hash=<file_hash>] [--validate_file] [--optimize_file]
[--fee_currency=<fee_currency>] [--fee_amount=<fee_amount>] [--fee_address=<fee_address>] [--fee_currency=<fee_currency>] [--fee_amount=<fee_amount>] [--fee_address=<fee_address>]
[--title=<title>] [--description=<description>] [--author=<author>] [--title=<title>] [--description=<description>] [--author=<author>]
[--tags=<tags>...] [--languages=<languages>...] [--locations=<locations>...] [--tags=<tags>...] [--languages=<languages>...] [--locations=<locations>...]
[--license=<license>] [--license_url=<license_url>] [--thumbnail_url=<thumbnail_url>] [--license=<license>] [--license_url=<license_url>] [--thumbnail_url=<thumbnail_url>]
[--release_time=<release_time>] [--width=<width>] [--height=<height>] [--duration=<duration>] [--release_time=<release_time>] [--width=<width>] [--height=<height>] [--duration=<duration>]
[--channel_id=<channel_id> | --channel_name=<channel_name>] [--sd_hash=<sd_hash>] [--channel_id=<channel_id> | --channel_name=<channel_name>]
[--channel_account_id=<channel_account_id>...] [--channel_account_id=<channel_account_id>...]
[--account_id=<account_id>] [--wallet_id=<wallet_id>] [--account_id=<account_id>] [--wallet_id=<wallet_id>]
[--claim_address=<claim_address>] [--funding_account_ids=<funding_account_ids>...] [--claim_address=<claim_address>] [--funding_account_ids=<funding_account_ids>...]
@ -3012,6 +3012,8 @@ class Daemon(metaclass=JSONRPCServerType):
--name=<name> : (str) name of the content (can only consist of a-z A-Z 0-9 and -(dash)) --name=<name> : (str) name of the content (can only consist of a-z A-Z 0-9 and -(dash))
--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) name of file to be associated with stream.
--file_hash=<file_hash> : (str) hash of file to be associated with stream.
--validate_file : (bool) validate that the video container and encodings match --validate_file : (bool) validate that the video container and encodings match
common web browser support or that optimization succeeds if specified. common web browser support or that optimization succeeds if specified.
FFmpeg is required FFmpeg is required
@ -3074,6 +3076,7 @@ class Daemon(metaclass=JSONRPCServerType):
--width=<width> : (int) image/video width, automatically calculated from media file --width=<width> : (int) image/video width, automatically calculated from media file
--height=<height> : (int) image/video height, automatically calculated from media file --height=<height> : (int) image/video height, automatically calculated from media file
--duration=<duration> : (int) audio/video duration in seconds, automatically calculated --duration=<duration> : (int) audio/video duration in seconds, automatically calculated
--sd_hash=<sd_hash> : (str) sd_hash of stream
--channel_id=<channel_id> : (str) claim id of the publisher channel --channel_id=<channel_id> : (str) claim id of the publisher channel
--channel_name=<channel_name> : (str) name of publisher channel --channel_name=<channel_name> : (str) name of publisher channel
--channel_account_id=<channel_account_id>: (str) one or more account ids for accounts to look in --channel_account_id=<channel_account_id>: (str) one or more account ids for accounts to look in
@ -3191,16 +3194,15 @@ class Daemon(metaclass=JSONRPCServerType):
Make a new stream claim and announce the associated file to lbrynet. Make a new stream claim and announce the associated file to lbrynet.
Usage: Usage:
stream_create (<name> | --name=<name>) (<bid> | --bid=<bid>) stream_create (<name> | --name=<name>) (<bid> | --bid=<bid>) [<file_path> | --file_path=<file_path>]
[<file_path> | --file_path=<file_path>] [--file_name=<file_name>] [--file_hash=<file_hash>] [--validate_file] [--optimize_file]
[--validate_file] [--optimize_file]
[--allow_duplicate_name=<allow_duplicate_name>] [--allow_duplicate_name=<allow_duplicate_name>]
[--fee_currency=<fee_currency>] [--fee_amount=<fee_amount>] [--fee_address=<fee_address>] [--fee_currency=<fee_currency>] [--fee_amount=<fee_amount>] [--fee_address=<fee_address>]
[--title=<title>] [--description=<description>] [--author=<author>] [--title=<title>] [--description=<description>] [--author=<author>]
[--tags=<tags>...] [--languages=<languages>...] [--locations=<locations>...] [--tags=<tags>...] [--languages=<languages>...] [--locations=<locations>...]
[--license=<license>] [--license_url=<license_url>] [--thumbnail_url=<thumbnail_url>] [--license=<license>] [--license_url=<license_url>] [--thumbnail_url=<thumbnail_url>]
[--release_time=<release_time>] [--width=<width>] [--height=<height>] [--duration=<duration>] [--release_time=<release_time>] [--width=<width>] [--height=<height>] [--duration=<duration>]
[--channel_id=<channel_id> | --channel_name=<channel_name>] [--sd_hash=<sd_hash>] [--channel_id=<channel_id> | --channel_name=<channel_name>]
[--channel_account_id=<channel_account_id>...] [--channel_account_id=<channel_account_id>...]
[--account_id=<account_id>] [--wallet_id=<wallet_id>] [--account_id=<account_id>] [--wallet_id=<wallet_id>]
[--claim_address=<claim_address>] [--funding_account_ids=<funding_account_ids>...] [--claim_address=<claim_address>] [--funding_account_ids=<funding_account_ids>...]
@ -3210,6 +3212,8 @@ class Daemon(metaclass=JSONRPCServerType):
--name=<name> : (str) name of the content (can only consist of a-z A-Z 0-9 and -(dash)) --name=<name> : (str) name of the content (can only consist of a-z A-Z 0-9 and -(dash))
--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) name of file to be associated with stream.
--file_hash=<file_hash> : (str) hash of file to be associated with stream.
--validate_file : (bool) validate that the video container and encodings match --validate_file : (bool) validate that the video container and encodings match
common web browser support or that optimization succeeds if specified. common web browser support or that optimization succeeds if specified.
FFmpeg is required FFmpeg is required
@ -3274,6 +3278,7 @@ class Daemon(metaclass=JSONRPCServerType):
--width=<width> : (int) image/video width, automatically calculated from media file --width=<width> : (int) image/video width, automatically calculated from media file
--height=<height> : (int) image/video height, automatically calculated from media file --height=<height> : (int) image/video height, automatically calculated from media file
--duration=<duration> : (int) audio/video duration in seconds, automatically calculated --duration=<duration> : (int) audio/video duration in seconds, automatically calculated
--sd_hash=<sd_hash> : (str) sd_hash of stream
--channel_id=<channel_id> : (str) claim id of the publisher channel --channel_id=<channel_id> : (str) claim id of the publisher channel
--channel_name=<channel_name> : (str) name of the publisher channel --channel_name=<channel_name> : (str) name of the publisher channel
--channel_account_id=<channel_account_id>: (str) one or more account ids for accounts to look in --channel_account_id=<channel_account_id>: (str) one or more account ids for accounts to look in
@ -3370,7 +3375,7 @@ class Daemon(metaclass=JSONRPCServerType):
[--locations=<locations>...] [--clear_locations] [--locations=<locations>...] [--clear_locations]
[--license=<license>] [--license_url=<license_url>] [--thumbnail_url=<thumbnail_url>] [--license=<license>] [--license_url=<license_url>] [--thumbnail_url=<thumbnail_url>]
[--release_time=<release_time>] [--width=<width>] [--height=<height>] [--duration=<duration>] [--release_time=<release_time>] [--width=<width>] [--height=<height>] [--duration=<duration>]
[--channel_id=<channel_id> | --channel_name=<channel_name> | --clear_channel] [--sd_hash=<sd_hash>] [--channel_id=<channel_id> | --channel_name=<channel_name> | --clear_channel]
[--channel_account_id=<channel_account_id>...] [--channel_account_id=<channel_account_id>...]
[--account_id=<account_id>] [--wallet_id=<wallet_id>] [--account_id=<account_id>] [--wallet_id=<wallet_id>]
[--claim_address=<claim_address>] [--funding_account_ids=<funding_account_ids>...] [--claim_address=<claim_address>] [--funding_account_ids=<funding_account_ids>...]
@ -3449,6 +3454,7 @@ class Daemon(metaclass=JSONRPCServerType):
--width=<width> : (int) image/video width, automatically calculated from media file --width=<width> : (int) image/video width, automatically calculated from media file
--height=<height> : (int) image/video height, automatically calculated from media file --height=<height> : (int) image/video height, automatically calculated from media file
--duration=<duration> : (int) audio/video duration in seconds, automatically calculated --duration=<duration> : (int) audio/video duration in seconds, automatically calculated
--sd_hash=<sd_hash> : (str) sd_hash of stream
--channel_id=<channel_id> : (str) claim id of the publisher channel --channel_id=<channel_id> : (str) claim id of the publisher channel
--channel_name=<channel_name> : (str) name of the publisher channel --channel_name=<channel_name> : (str) name of the publisher channel
--clear_channel : (bool) remove channel signature --clear_channel : (bool) remove channel signature

View file

@ -1990,14 +1990,17 @@ class StreamCommands(ClaimTestCase):
self.assertNotIn('source', claim['value']) self.assertNotIn('source', claim['value'])
# update the stream to have a source # update the stream to have a source
with tempfile.NamedTemporaryFile() as file: tx6 = await self.publish(
file.write(b'hi') 'future-release', sd_hash='beef', file_hash='beef',
file.flush() file_name='blah.mp3', tags=['something-else']
tx6 = await self.publish('future-release', file_path=file.name, tags=['something-else']) )
claim = await self.resolve('lbry://future-release') claim = await self.resolve('lbry://future-release')
self.assertEqual(claim['txid'], tx6['outputs'][0]['txid']) self.assertEqual(claim['txid'], tx6['outputs'][0]['txid'])
self.assertEqual(claim['value']['tags'], ['something-else']) self.assertEqual(claim['value']['tags'], ['something-else'])
self.assertIn('source', claim['value']) self.assertEqual(claim['value']['source']['sd_hash'], 'beef')
self.assertEqual(claim['value']['source']['hash'], 'beef')
self.assertEqual(claim['value']['source']['name'], 'blah.mp3')
self.assertEqual(claim['value']['source']['media_type'], 'audio/mpeg')
class SupportCommands(CommandTestCase): class SupportCommands(CommandTestCase):