audio/video/image stream types

This commit is contained in:
Lex Berezhny 2019-03-25 12:30:30 -04:00
parent 1cb696fb5c
commit c708c1db07
4 changed files with 340 additions and 161 deletions

View file

@ -1869,12 +1869,14 @@ class Daemon(metaclass=JSONRPCServerType):
Usage: Usage:
publish (<name> | --name=<name>) (<bid> | --bid=<bid>) (<file_path> | --file_path=<file_path>) publish (<name> | --name=<name>) (<bid> | --bid=<bid>) (<file_path> | --file_path=<file_path>)
(<stream_type> | --stream_type=<stream_type>)
[--tags=<tags>...] [--allow_duplicate_name=<allow_duplicate_name>] [--tags=<tags>...] [--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>] [--language=<language>] [--title=<title>] [--description=<description>] [--author=<author>] [--language=<language>]
[--license=<license>] [--license_url=<license_url>] [--thumbnail_url=<thumbnail_url>] [--license=<license>] [--license_url=<license_url>] [--thumbnail_url=<thumbnail_url>]
[--release_time=<release_time>] [--duration=<duration>] [--release_time=<release_time>] [--stream_type=<stream_type>]
[--video_width=<video_width>] [--video_height=<video_height>] [--video_width=<video_width>] [--video_height=<video_height>] [--video_duration=<video_duration>]
[--image_width=<image_width>] [--image_height=<image_height>] [--audio_duration=<audio_duration>]
[--channel_id=<channel_id>] [--channel_account_id=<channel_account_id>...] [--channel_id=<channel_id>] [--channel_account_id=<channel_account_id>...]
[--account_id=<account_id>] [--claim_address=<claim_address>] [--preview] [--account_id=<account_id>] [--claim_address=<claim_address>] [--preview]
@ -1903,8 +1905,15 @@ class Daemon(metaclass=JSONRPCServerType):
--release_time=<duration> : (int) original public release of content, seconds since UNIX epoch --release_time=<duration> : (int) original public release of content, seconds since UNIX epoch
--duration=<duration> : (int) audio/video duration in seconds, an attempt will be made to --duration=<duration> : (int) audio/video duration in seconds, an attempt will be made to
calculate this automatically if not provided calculate this automatically if not provided
--stream_type=<stream_type> : (str) type of stream
--image_width=<image_width> : (int) image width
--image_height=<image_height> : (int) image height
--video_width=<video_width> : (int) video width --video_width=<video_width> : (int) video width
--video_height=<video_height> : (int) video height --video_height=<video_height> : (int) video height
--video_duration=<duration> : (int) video duration in seconds, an attempt will be made to
calculate this automatically if not provided
--audio_duration=<duration> : (int) audio duration in seconds, an attempt will be made to
calculate this automatically if not provided
--channel_id=<channel_id> : (str) claim id of the publisher channel --channel_id=<channel_id> : (str) claim id of the publisher channel
--channel_account_id=<channel_id>: (str) one or more account ids for accounts to look in --channel_account_id=<channel_id>: (str) one or more account ids for accounts to look in
for channel certificates, defaults to all accounts. for channel certificates, defaults to all accounts.
@ -1971,8 +1980,9 @@ class Daemon(metaclass=JSONRPCServerType):
[--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>] [--language=<language>] [--title=<title>] [--description=<description>] [--author=<author>] [--language=<language>]
[--license=<license>] [--license_url=<license_url>] [--thumbnail_url=<thumbnail_url>] [--license=<license>] [--license_url=<license_url>] [--thumbnail_url=<thumbnail_url>]
[--release_time=<release_time>] [--duration=<duration>] [--release_time=<release_time>] [--stream_type=<stream_type>]
[--video_width=<video_width>] [--video_height=<video_height>] [--video_width=<video_width>] [--video_height=<video_height>] [--video_duration=<video_duration>]
[--image_width=<image_width>] [--image_height=<image_height>] [--audio_duration=<audio_duration>]
[--channel_id=<channel_id>] [--channel_account_id=<channel_account_id>...] [--clear-channel] [--channel_id=<channel_id>] [--channel_account_id=<channel_account_id>...] [--clear-channel]
[--account_id=<account_id>] [--claim_address=<claim_address>] [--preview] [--account_id=<account_id>] [--claim_address=<claim_address>] [--preview]
@ -1998,10 +2008,15 @@ class Daemon(metaclass=JSONRPCServerType):
--license_url=<license_url> : (str) publication license url --license_url=<license_url> : (str) publication license url
--thumbnail_url=<thumbnail_url>: (str) thumbnail url --thumbnail_url=<thumbnail_url>: (str) thumbnail url
--release_time=<duration> : (int) original public release of content, seconds since UNIX epoch --release_time=<duration> : (int) original public release of content, seconds since UNIX epoch
--duration=<duration> : (int) audio/video duration in seconds, an attempt will be made to --stream_type=<stream_type> : (str) type of stream
calculate this automatically if not provided --image_width=<image_width> : (int) image width
--image_height=<image_height> : (int) image height
--video_width=<video_width> : (int) video width --video_width=<video_width> : (int) video width
--video_height=<video_height> : (int) video height --video_height=<video_height> : (int) video height
--video_duration=<duration> : (int) video duration in seconds, an attempt will be made to
calculate this automatically if not provided
--audio_duration=<duration> : (int) audio duration in seconds, an attempt will be made to
calculate this automatically if not provided
--channel_id=<channel_id> : (str) claim id of the publisher channel --channel_id=<channel_id> : (str) claim id of the publisher channel
--clear-channel : (bool) remove channel signature --clear-channel : (bool) remove channel signature
--channel_account_id=<channel_id>: (str) one or more account ids for accounts to look in --channel_account_id=<channel_id>: (str) one or more account ids for accounts to look in

View file

@ -82,28 +82,25 @@ class Claim(Signable):
return claim return claim
class Video: class Dimmensional:
__slots__ = '_video', __slots__ = ()
def __init__(self, video_message):
self._video = video_message
@property @property
def width(self) -> int: def width(self) -> int:
return self._video.width return self.message.width
@width.setter @width.setter
def width(self, width: int): def width(self, width: int):
self._video.width = width self.message.width = width
@property @property
def height(self) -> int: def height(self) -> int:
return self._video.height return self.message.height
@height.setter @height.setter
def height(self, height: int): def height(self, height: int):
self._video.height = height self.message.height = height
@property @property
def dimensions(self) -> Tuple[int, int]: def dimensions(self) -> Tuple[int, int]:
@ -111,7 +108,51 @@ class Video:
@dimensions.setter @dimensions.setter
def dimensions(self, dimensions: Tuple[int, int]): def dimensions(self, dimensions: Tuple[int, int]):
self._video.width, self._video.height = dimensions self.message.width, self.message.height = dimensions
class Playable:
__slots__ = ()
@property
def duration(self) -> int:
return self.message.duration
@duration.setter
def duration(self, duration: int):
self.message.duration = duration
def set_duration_from_path(self, file_path):
try:
file_metadata = binary_file_metadata(binary_file_parser(file_path))
self.duration = file_metadata.getValues('duration')[0].seconds
except:
pass
class Image(Dimmensional):
__slots__ = 'message',
def __init__(self, image_message):
self.message = image_message
class Video(Dimmensional, Playable):
__slots__ = 'message',
def __init__(self, video_message):
self.message = video_message
class Audio(Playable):
__slots__ = 'message',
def __init__(self, audio_message):
self.message = audio_message
class File: class File:
@ -226,6 +267,10 @@ class BaseClaimSubType:
def __init__(self, claim: Claim): def __init__(self, claim: Claim):
self.claim = claim or Claim() self.claim = claim or Claim()
@property
def tags(self) -> List:
return self.message.tags
@property @property
def title(self) -> str: def title(self) -> str:
return self.message.title return self.message.title
@ -242,14 +287,6 @@ class BaseClaimSubType:
def description(self, description: str): def description(self, description: str):
self.message.description = description self.message.description = description
@property
def language(self) -> str:
return self.message.language
@language.setter
def language(self, language: str):
self.message.language = language
@property @property
def thumbnail_url(self) -> str: def thumbnail_url(self) -> str:
return self.message.thumbnail_url return self.message.thumbnail_url
@ -259,8 +296,12 @@ class BaseClaimSubType:
self.message.thumbnail_url = thumbnail_url self.message.thumbnail_url = thumbnail_url
@property @property
def tags(self) -> List: def language(self) -> str:
return self.message.tags return self.message.language
@language.setter
def language(self, language: str):
self.message.language = language
def to_dict(self): def to_dict(self):
return MessageToDict(self.message, preserving_proto_field_name=True) return MessageToDict(self.message, preserving_proto_field_name=True)
@ -340,19 +381,35 @@ class Stream(BaseClaimSubType):
self.message = self.claim.stream_message self.message = self.claim.stream_message
def update( def update(
self, file_path=None, duration=None, self, file_path=None, stream_type=None,
fee_currency=None, fee_amount=None, fee_address=None, fee_currency=None, fee_amount=None, fee_address=None,
video_height=None, video_width=None,
**kwargs): **kwargs):
duration_was_not_set = True
sub_types = ('image', 'video', 'audio')
for key in list(kwargs.keys()):
for sub_type in sub_types:
if key.startswith(f'{sub_type}_'):
stream_type = sub_type
sub_obj = getattr(self, sub_type)
sub_obj_attr = key[len(f'{sub_type}_'):]
setattr(sub_obj, sub_obj_attr, kwargs.pop(key))
if sub_obj_attr == 'duration':
duration_was_not_set = False
break
if stream_type is not None:
if stream_type not in sub_types:
raise Exception(
f"stream_type of '{stream_type}' is not valid, must be one of: {sub_types}"
)
sub_obj = getattr(self, stream_type)
if duration_was_not_set and file_path and isinstance(sub_obj, Playable):
sub_obj.set_duration_from_path(file_path)
super().update(**kwargs) super().update(**kwargs)
if video_height is not None:
self.video.height = video_height
if video_width is not None:
self.video.width = video_width
if file_path is not None: if file_path is not None:
self.media_type = guess_media_type(file_path) self.media_type = guess_media_type(file_path)
if not os.path.isfile(file_path): if not os.path.isfile(file_path):
@ -371,31 +428,6 @@ class Stream(BaseClaimSubType):
else: else:
raise Exception(f'Unknown currency type: {fee_currency}') raise Exception(f'Unknown currency type: {fee_currency}')
if duration is not None:
self.duration = duration
elif file_path is not None:
try:
file_metadata = binary_file_metadata(binary_file_parser(file_path))
self.duration = file_metadata.getValues('duration')[0].seconds
except:
pass
@property
def video(self) -> Video:
return Video(self.message.video)
@property
def file(self) -> File:
return File(self.message.file)
@property
def fee(self) -> Fee:
return Fee(self.message.fee)
@property
def has_fee(self) -> bool:
return self.message.HasField('fee')
@property @property
def hash(self) -> str: def hash(self) -> str:
return hexlify(self.message.hash).decode() return hexlify(self.message.hash).decode()
@ -420,14 +452,6 @@ class Stream(BaseClaimSubType):
def author(self, author: str): def author(self, author: str):
self.message.author = author self.message.author = author
@property
def media_type(self) -> str:
return self.message.media_type
@media_type.setter
def media_type(self, media_type: str):
self.message.media_type = media_type
@property @property
def license(self) -> str: def license(self) -> str:
return self.message.license return self.message.license
@ -444,14 +468,6 @@ class Stream(BaseClaimSubType):
def license_url(self, license_url: str): def license_url(self, license_url: str):
self.message.license_url = license_url self.message.license_url = license_url
@property
def duration(self) -> int:
return self.message.duration
@duration.setter
def duration(self, duration: int):
self.message.duration = duration
@property @property
def release_time(self) -> int: def release_time(self) -> int:
return self.message.release_time return self.message.release_time
@ -459,3 +475,35 @@ class Stream(BaseClaimSubType):
@release_time.setter @release_time.setter
def release_time(self, release_time: int): def release_time(self, release_time: int):
self.message.release_time = release_time self.message.release_time = release_time
@property
def media_type(self) -> str:
return self.message.media_type
@media_type.setter
def media_type(self, media_type: str):
self.message.media_type = media_type
@property
def fee(self) -> Fee:
return Fee(self.message.fee)
@property
def has_fee(self) -> bool:
return self.message.HasField('fee')
@property
def file(self) -> File:
return File(self.message.file)
@property
def image(self) -> Image:
return Image(self.message.image)
@property
def video(self) -> Video:
return Video(self.message.video)
@property
def audio(self) -> Audio:
return Audio(self.message.audio)

View file

@ -19,7 +19,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
package='pb', package='pb',
syntax='proto3', syntax='proto3',
serialized_options=None, serialized_options=None,
serialized_pb=_b('\n\x0b\x63laim.proto\x12\x02pb\"M\n\x05\x43laim\x12\x1c\n\x06stream\x18\x01 \x01(\x0b\x32\n.pb.StreamH\x00\x12\x1e\n\x07\x63hannel\x18\x02 \x01(\x0b\x32\x0b.pb.ChannelH\x00\x42\x06\n\x04type\"\xb8\x01\n\x07\x43hannel\x12\x12\n\npublic_key\x18\x01 \x01(\x0c\x12\r\n\x05title\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x15\n\rcontact_email\x18\x04 \x01(\t\x12\x14\n\x0chomepage_url\x18\x05 \x01(\t\x12\x0c\n\x04tags\x18\x06 \x03(\t\x12\x15\n\rthumbnail_url\x18\x10 \x01(\t\x12\x11\n\tcover_url\x18\x11 \x01(\t\x12\x10\n\x08language\x18\x12 \x01(\t\"\xab\x02\n\x06Stream\x12\x0c\n\x04hash\x18\x01 \x01(\x0c\x12\x10\n\x08language\x18\x02 \x01(\t\x12\r\n\x05title\x18\x03 \x01(\t\x12\x0e\n\x06\x61uthor\x18\x04 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x05 \x01(\t\x12\x12\n\nmedia_type\x18\x06 \x01(\t\x12\x0f\n\x07license\x18\x07 \x01(\t\x12\x16\n\x04\x66ile\x18\x08 \x01(\x0b\x32\x08.pb.File\x12\x14\n\x03\x66\x65\x65\x18\x10 \x01(\x0b\x32\x07.pb.Fee\x12\x13\n\x0blicense_url\x18\x11 \x01(\t\x12\x15\n\rthumbnail_url\x18\x12 \x01(\t\x12\x10\n\x08\x64uration\x18\x13 \x01(\r\x12\x0c\n\x04tags\x18\x14 \x03(\t\x12\x14\n\x0crelease_time\x18\x15 \x01(\x03\x12\x18\n\x05video\x18\x16 \x01(\x0b\x32\t.pb.Video\"h\n\x03\x46\x65\x65\x12\"\n\x08\x63urrency\x18\x01 \x01(\x0e\x32\x10.pb.Fee.Currency\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\x0c\x12\x0e\n\x06\x61mount\x18\x03 \x01(\x04\"\x1c\n\x08\x43urrency\x12\x07\n\x03LBC\x10\x00\x12\x07\n\x03USD\x10\x01\"\"\n\x04\x46ile\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04size\x18\x02 \x01(\x04\"&\n\x05Video\x12\r\n\x05width\x18\x01 \x01(\r\x12\x0e\n\x06height\x18\x02 \x01(\rb\x06proto3') serialized_pb=_b('\n\x0b\x63laim.proto\x12\x02pb\"M\n\x05\x43laim\x12\x1c\n\x06stream\x18\x01 \x01(\x0b\x32\n.pb.StreamH\x00\x12\x1e\n\x07\x63hannel\x18\x02 \x01(\x0b\x32\x0b.pb.ChannelH\x00\x42\x06\n\x04type\"\xb8\x01\n\x07\x43hannel\x12\x12\n\npublic_key\x18\x01 \x01(\x0c\x12\x0c\n\x04tags\x18\x02 \x03(\t\x12\r\n\x05title\x18\x03 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x04 \x01(\t\x12\x15\n\rthumbnail_url\x18\x05 \x01(\t\x12\x10\n\x08language\x18\x06 \x01(\t\x12\x15\n\rcontact_email\x18\x07 \x01(\t\x12\x14\n\x0chomepage_url\x18\x08 \x01(\t\x12\x11\n\tcover_url\x18\t \x01(\t\"\xdb\x02\n\x06Stream\x12\x0c\n\x04hash\x18\x01 \x01(\x0c\x12\x0c\n\x04tags\x18\x02 \x03(\t\x12\r\n\x05title\x18\x03 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x04 \x01(\t\x12\x15\n\rthumbnail_url\x18\x05 \x01(\t\x12\x10\n\x08language\x18\x06 \x01(\t\x12\x0e\n\x06\x61uthor\x18\x07 \x01(\t\x12\x0f\n\x07license\x18\x08 \x01(\t\x12\x13\n\x0blicense_url\x18\t \x01(\t\x12\x14\n\x0crelease_time\x18\n \x01(\x03\x12\x12\n\nmedia_type\x18\r \x01(\t\x12\x14\n\x03\x66\x65\x65\x18\x0e \x01(\x0b\x32\x07.pb.Fee\x12\x16\n\x04\x66ile\x18\x0f \x01(\x0b\x32\x08.pb.File\x12\x1a\n\x05image\x18\x10 \x01(\x0b\x32\t.pb.ImageH\x00\x12\x1a\n\x05video\x18\x11 \x01(\x0b\x32\t.pb.VideoH\x00\x12\x1a\n\x05\x61udio\x18\x12 \x01(\x0b\x32\t.pb.AudioH\x00\x42\x06\n\x04type\"h\n\x03\x46\x65\x65\x12\"\n\x08\x63urrency\x18\x01 \x01(\x0e\x32\x10.pb.Fee.Currency\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\x0c\x12\x0e\n\x06\x61mount\x18\x03 \x01(\x04\"\x1c\n\x08\x43urrency\x12\x07\n\x03LBC\x10\x00\x12\x07\n\x03USD\x10\x01\"\"\n\x04\x46ile\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04size\x18\x02 \x01(\x04\"&\n\x05Image\x12\r\n\x05width\x18\x01 \x01(\r\x12\x0e\n\x06height\x18\x02 \x01(\r\"8\n\x05Video\x12\r\n\x05width\x18\x01 \x01(\r\x12\x0e\n\x06height\x18\x02 \x01(\r\x12\x10\n\x08\x64uration\x18\x03 \x01(\r\"\x19\n\x05\x41udio\x12\x10\n\x08\x64uration\x18\x01 \x01(\rb\x06proto3')
) )
@ -41,8 +41,8 @@ _FEE_CURRENCY = _descriptor.EnumDescriptor(
], ],
containing_type=None, containing_type=None,
serialized_options=None, serialized_options=None,
serialized_start=663, serialized_start=711,
serialized_end=691, serialized_end=739,
) )
_sym_db.RegisterEnumDescriptor(_FEE_CURRENCY) _sym_db.RegisterEnumDescriptor(_FEE_CURRENCY)
@ -103,57 +103,57 @@ _CHANNEL = _descriptor.Descriptor(
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='title', full_name='pb.Channel.title', index=1, name='tags', full_name='pb.Channel.tags', index=1,
number=2, type=9, cpp_type=9, label=1, number=2, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=_b("").decode('utf-8'), has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='description', full_name='pb.Channel.description', index=2, name='title', full_name='pb.Channel.title', index=2,
number=3, type=9, cpp_type=9, label=1, number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'), has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='contact_email', full_name='pb.Channel.contact_email', index=3, name='description', full_name='pb.Channel.description', index=3,
number=4, type=9, cpp_type=9, label=1, number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'), has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='homepage_url', full_name='pb.Channel.homepage_url', index=4, name='thumbnail_url', full_name='pb.Channel.thumbnail_url', index=4,
number=5, type=9, cpp_type=9, label=1, number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'), has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='tags', full_name='pb.Channel.tags', index=5, name='language', full_name='pb.Channel.language', index=5,
number=6, type=9, cpp_type=9, label=3, number=6, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='thumbnail_url', full_name='pb.Channel.thumbnail_url', index=6,
number=16, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'), has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='cover_url', full_name='pb.Channel.cover_url', index=7, name='contact_email', full_name='pb.Channel.contact_email', index=6,
number=17, type=9, cpp_type=9, label=1, number=7, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'), has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='language', full_name='pb.Channel.language', index=8, name='homepage_url', full_name='pb.Channel.homepage_url', index=7,
number=18, type=9, cpp_type=9, label=1, number=8, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cover_url', full_name='pb.Channel.cover_url', index=8,
number=9, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'), has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
@ -190,9 +190,9 @@ _STREAM = _descriptor.Descriptor(
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='language', full_name='pb.Stream.language', index=1, name='tags', full_name='pb.Stream.tags', index=1,
number=2, type=9, cpp_type=9, label=1, number=2, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=_b("").decode('utf-8'), has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
@ -204,85 +204,92 @@ _STREAM = _descriptor.Descriptor(
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='author', full_name='pb.Stream.author', index=3, name='description', full_name='pb.Stream.description', index=3,
number=4, type=9, cpp_type=9, label=1, number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'), has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='description', full_name='pb.Stream.description', index=4, name='thumbnail_url', full_name='pb.Stream.thumbnail_url', index=4,
number=5, type=9, cpp_type=9, label=1, number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'), has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='media_type', full_name='pb.Stream.media_type', index=5, name='language', full_name='pb.Stream.language', index=5,
number=6, type=9, cpp_type=9, label=1, number=6, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'), has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='license', full_name='pb.Stream.license', index=6, name='author', full_name='pb.Stream.author', index=6,
number=7, type=9, cpp_type=9, label=1, number=7, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'), has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='file', full_name='pb.Stream.file', index=7, name='license', full_name='pb.Stream.license', index=7,
number=8, type=11, cpp_type=10, label=1, number=8, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='license_url', full_name='pb.Stream.license_url', index=8,
number=9, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='release_time', full_name='pb.Stream.release_time', index=9,
number=10, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='media_type', full_name='pb.Stream.media_type', index=10,
number=13, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='fee', full_name='pb.Stream.fee', index=11,
number=14, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None, has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='fee', full_name='pb.Stream.fee', index=8, name='file', full_name='pb.Stream.file', index=12,
number=15, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='image', full_name='pb.Stream.image', index=13,
number=16, type=11, cpp_type=10, label=1, number=16, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None, has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='license_url', full_name='pb.Stream.license_url', index=9,
number=17, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='thumbnail_url', full_name='pb.Stream.thumbnail_url', index=10,
number=18, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='duration', full_name='pb.Stream.duration', index=11,
number=19, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='tags', full_name='pb.Stream.tags', index=12,
number=20, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='release_time', full_name='pb.Stream.release_time', index=13,
number=21, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor( _descriptor.FieldDescriptor(
name='video', full_name='pb.Stream.video', index=14, name='video', full_name='pb.Stream.video', index=14,
number=22, type=11, cpp_type=10, label=1, number=17, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='audio', full_name='pb.Stream.audio', index=15,
number=18, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None, has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
@ -298,9 +305,12 @@ _STREAM = _descriptor.Descriptor(
syntax='proto3', syntax='proto3',
extension_ranges=[], extension_ranges=[],
oneofs=[ oneofs=[
_descriptor.OneofDescriptor(
name='type', full_name='pb.Stream.type',
index=0, containing_type=None, fields=[]),
], ],
serialized_start=286, serialized_start=286,
serialized_end=585, serialized_end=633,
) )
@ -345,8 +355,8 @@ _FEE = _descriptor.Descriptor(
extension_ranges=[], extension_ranges=[],
oneofs=[ oneofs=[
], ],
serialized_start=587, serialized_start=635,
serialized_end=691, serialized_end=739,
) )
@ -383,8 +393,46 @@ _FILE = _descriptor.Descriptor(
extension_ranges=[], extension_ranges=[],
oneofs=[ oneofs=[
], ],
serialized_start=693, serialized_start=741,
serialized_end=727, serialized_end=775,
)
_IMAGE = _descriptor.Descriptor(
name='Image',
full_name='pb.Image',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='width', full_name='pb.Image.width', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='height', full_name='pb.Image.height', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=777,
serialized_end=815,
) )
@ -409,6 +457,13 @@ _VIDEO = _descriptor.Descriptor(
message_type=None, enum_type=None, containing_type=None, message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None, is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR), serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='duration', full_name='pb.Video.duration', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
], ],
extensions=[ extensions=[
], ],
@ -421,8 +476,39 @@ _VIDEO = _descriptor.Descriptor(
extension_ranges=[], extension_ranges=[],
oneofs=[ oneofs=[
], ],
serialized_start=729, serialized_start=817,
serialized_end=767, serialized_end=873,
)
_AUDIO = _descriptor.Descriptor(
name='Audio',
full_name='pb.Audio',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='duration', full_name='pb.Audio.duration', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=875,
serialized_end=900,
) )
_CLAIM.fields_by_name['stream'].message_type = _STREAM _CLAIM.fields_by_name['stream'].message_type = _STREAM
@ -433,9 +519,20 @@ _CLAIM.fields_by_name['stream'].containing_oneof = _CLAIM.oneofs_by_name['type']
_CLAIM.oneofs_by_name['type'].fields.append( _CLAIM.oneofs_by_name['type'].fields.append(
_CLAIM.fields_by_name['channel']) _CLAIM.fields_by_name['channel'])
_CLAIM.fields_by_name['channel'].containing_oneof = _CLAIM.oneofs_by_name['type'] _CLAIM.fields_by_name['channel'].containing_oneof = _CLAIM.oneofs_by_name['type']
_STREAM.fields_by_name['file'].message_type = _FILE
_STREAM.fields_by_name['fee'].message_type = _FEE _STREAM.fields_by_name['fee'].message_type = _FEE
_STREAM.fields_by_name['file'].message_type = _FILE
_STREAM.fields_by_name['image'].message_type = _IMAGE
_STREAM.fields_by_name['video'].message_type = _VIDEO _STREAM.fields_by_name['video'].message_type = _VIDEO
_STREAM.fields_by_name['audio'].message_type = _AUDIO
_STREAM.oneofs_by_name['type'].fields.append(
_STREAM.fields_by_name['image'])
_STREAM.fields_by_name['image'].containing_oneof = _STREAM.oneofs_by_name['type']
_STREAM.oneofs_by_name['type'].fields.append(
_STREAM.fields_by_name['video'])
_STREAM.fields_by_name['video'].containing_oneof = _STREAM.oneofs_by_name['type']
_STREAM.oneofs_by_name['type'].fields.append(
_STREAM.fields_by_name['audio'])
_STREAM.fields_by_name['audio'].containing_oneof = _STREAM.oneofs_by_name['type']
_FEE.fields_by_name['currency'].enum_type = _FEE_CURRENCY _FEE.fields_by_name['currency'].enum_type = _FEE_CURRENCY
_FEE_CURRENCY.containing_type = _FEE _FEE_CURRENCY.containing_type = _FEE
DESCRIPTOR.message_types_by_name['Claim'] = _CLAIM DESCRIPTOR.message_types_by_name['Claim'] = _CLAIM
@ -443,7 +540,9 @@ DESCRIPTOR.message_types_by_name['Channel'] = _CHANNEL
DESCRIPTOR.message_types_by_name['Stream'] = _STREAM DESCRIPTOR.message_types_by_name['Stream'] = _STREAM
DESCRIPTOR.message_types_by_name['Fee'] = _FEE DESCRIPTOR.message_types_by_name['Fee'] = _FEE
DESCRIPTOR.message_types_by_name['File'] = _FILE DESCRIPTOR.message_types_by_name['File'] = _FILE
DESCRIPTOR.message_types_by_name['Image'] = _IMAGE
DESCRIPTOR.message_types_by_name['Video'] = _VIDEO DESCRIPTOR.message_types_by_name['Video'] = _VIDEO
DESCRIPTOR.message_types_by_name['Audio'] = _AUDIO
_sym_db.RegisterFileDescriptor(DESCRIPTOR) _sym_db.RegisterFileDescriptor(DESCRIPTOR)
Claim = _reflection.GeneratedProtocolMessageType('Claim', (_message.Message,), dict( Claim = _reflection.GeneratedProtocolMessageType('Claim', (_message.Message,), dict(
@ -481,6 +580,13 @@ File = _reflection.GeneratedProtocolMessageType('File', (_message.Message,), dic
)) ))
_sym_db.RegisterMessage(File) _sym_db.RegisterMessage(File)
Image = _reflection.GeneratedProtocolMessageType('Image', (_message.Message,), dict(
DESCRIPTOR = _IMAGE,
__module__ = 'claim_pb2'
# @@protoc_insertion_point(class_scope:pb.Image)
))
_sym_db.RegisterMessage(Image)
Video = _reflection.GeneratedProtocolMessageType('Video', (_message.Message,), dict( Video = _reflection.GeneratedProtocolMessageType('Video', (_message.Message,), dict(
DESCRIPTOR = _VIDEO, DESCRIPTOR = _VIDEO,
__module__ = 'claim_pb2' __module__ = 'claim_pb2'
@ -488,5 +594,12 @@ Video = _reflection.GeneratedProtocolMessageType('Video', (_message.Message,), d
)) ))
_sym_db.RegisterMessage(Video) _sym_db.RegisterMessage(Video)
Audio = _reflection.GeneratedProtocolMessageType('Audio', (_message.Message,), dict(
DESCRIPTOR = _AUDIO,
__module__ = 'claim_pb2'
# @@protoc_insertion_point(class_scope:pb.Audio)
))
_sym_db.RegisterMessage(Audio)
# @@protoc_insertion_point(module_scope) # @@protoc_insertion_point(module_scope)

View file

@ -69,14 +69,14 @@ class ChannelCommands(CommandTestCase):
async def test_setting_channel_fields(self): async def test_setting_channel_fields(self):
values = { values = {
'tags': ["cool", "awesome"],
'title': "Cool Channel", 'title': "Cool Channel",
'description': "Best channel on LBRY.", 'description': "Best channel on LBRY.",
'contact_email': "human@email.com",
'tags': ["cool", "awesome"],
'cover_url': "https://co.ol/cover.png",
'homepage_url': "https://co.ol",
'thumbnail_url': "https://co.ol/thumbnail.png", 'thumbnail_url': "https://co.ol/thumbnail.png",
'language': "en" 'language': "en",
'contact_email': "human@email.com",
'homepage_url': "https://co.ol",
'cover_url': "https://co.ol/cover.png",
} }
# create new channel with all fields set # create new channel with all fields set
@ -333,18 +333,21 @@ class ClaimCommands(CommandTestCase):
async def test_setting_claim_fields(self): async def test_setting_claim_fields(self):
values = { values = {
'tags': ["cool", "awesome"],
'title': "Cool Content", 'title': "Cool Content",
'description': "Best content on LBRY.", 'description': "Best content on LBRY.",
'author': "Jules Verne", 'thumbnail_url': "https://co.ol/thumbnail.png",
'language': "en", 'language': "en",
'tags': ["cool", "awesome"],
'author': "Jules Verne",
'license': 'Public Domain', 'license': 'Public Domain',
'license_url': "https://co.ol/license",
'release_time': 123456,
'fee_currency': 'usd', 'fee_currency': 'usd',
'fee_amount': '2.99', 'fee_amount': '2.99',
'fee_address': 'mmCsWAiXMUVecFQ3fVzUwvpT9XFMXno2Ca', 'fee_address': 'mmCsWAiXMUVecFQ3fVzUwvpT9XFMXno2Ca',
'license_url': "https://co.ol/license",
'thumbnail_url': "https://co.ol/thumbnail.png",
'release_time': 123456,
'video_width': 800, 'video_width': 800,
'video_height': 600 'video_height': 600
} }