Skip to content

Commit

Permalink
Version 0.3.5
Browse files Browse the repository at this point in the history
Expose `strict` option for `read_rla`
  • Loading branch information
mos9527 committed Sep 7, 2024
1 parent f0423d7 commit 5b818d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sssekai/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__VERSION_MAJOR__ = 0
__VERSION_MINOR__ = 3
__VERSION_PATCH__ = 4
__VERSION_PATCH__ = 5

__version__ = '%s.%s.%s' % (__VERSION_MAJOR__,__VERSION_MINOR__,__VERSION_PATCH__)
9 changes: 5 additions & 4 deletions sssekai/fmt/rla.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def decode_streaming_data(version : tuple, decoder_signature, buffer, strict=Tru
'''Decodes the streaming data payload into a dictionary.
Args:
version (tuple): RLA version. i.e. one of (1,0), (1,1), (1,2), (1,3), (1,4)
version (tuple): RLA version
decoder_signature (int): Decoder signature
buffer (bytes): Decoded payload data
strict (bool, optional): If False, incomplete packets will be returned as is. Defaults to True.
Expand Down Expand Up @@ -227,12 +227,13 @@ def gen_exception_handler(generator):
return {'type': 'Unknown', 'data': buffer}
result = defaultdict(dict)

def read_rla(src : BytesIO, version=(1,0)) -> dict:
def read_rla(src : BytesIO, version=(1,0), strict=True) -> dict:
'''Parses the Sekai RLA file format used in 'streaming_live/archive' assets.
Args:
src (BytesIO): Source RLA file stream
version (tuple, optional): RLA version, found in respective RLH (JSON) header files. Defaults to (1,0).
version (tuple, optional): RLA version, found in respective RLH (JSON) header files. i.e. one of (1,0), (1,1), (1,2), (1,3), (1,4) Defaults to (1,0).
strict (bool, optional): If False, incomplete packets will be returned as is. Defaults to True.
Returns:
dict: Parsed RLA data. The dictionary is sorted by the frame ticks.
Expand All @@ -246,7 +247,7 @@ def read_frames():
header_signature, data = decode_buffer_base64(buffer)
decoder_signature, data = decode_buffer_payload(data)
assert header_signature == decoder_signature, 'mismatching signature (header/decoder). packet may be corrupt'
payload = decode_streaming_data(version, decoder_signature, data)
payload = decode_streaming_data(version, decoder_signature, data, strict)
result[ticks].setdefault(payload['type'], list()).append(payload)
return True
return False
Expand Down

0 comments on commit 5b818d5

Please sign in to comment.