Parser for osr files and lzma replay streams for osu!
Project description
circleparse, a .osr and lzma parser
This fork is designed specifically for Circlecore, and extends the functionality of the upstream repo by allowing parsing of a pure lzma bytestring, instead of the bytestring contents of an entire .osr file. Usage:
from circleparse import parse_replay
# returns instance of Replay from an lzma bytestring with only the play_data field nonnull.
parse_replay(lzma_byte_string, pure_lzma=True)
Note that only information stored in the lzma bytestring is stored in the Replay instance. When pure_lzma is true, replay_data is the only populated field because lzma only contains cursor positioning and key presses. For more information, see the wiki.
Installation
To install, simply
pip install circleparse
Documentation
To parse a replay from a filepath:
from circleparse import parse_replay_file
#returns instance of Replay
parse_replay_file("path/to/osr.osr")
To parse a replay from a bytestring:
from circleparse import parse_replay
#returns instance of Replay given the replay data encoded as a bytestring
parse_replay(byte_string)
Replay instances provide these fields
self.game_mode #GameMode enum
self.game_version #Integer
self.beatmap_hash #String
self.player_name #String
self.replay_hash #String
self.number_300s #Integer
self.number_100s #Integer
self.number_50s #Integer
self.gekis #Integer
self.katus #Integer
self.misses #Integer
self.score #Integer
self.max_combo #Integer
self.is_perfect_combo #Boolean
self.mod_combination #frozenset of Mods
self.life_bar_graph #String, unparsed as of now
self.timestamp #Python Datetime object
self.play_data #List of ReplayEvent instances
ReplayEvent instances provide these fields
self.time_since_previous_action #Integer representing time in milliseconds
self.x #x axis location
self.y #y axis location
self.keys_pressed #bitwise sum of keys pressed, documented in OSR format page
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for circleparse-5.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fab194c7c48562d8194e781a2458078e5cc2c4ee79795a843390bbf46eb05d5e |
|
MD5 | ada51183e0eebe0cef81d491767150c9 |
|
BLAKE2b-256 | 903c8507f0b39f1bd16a1082dc86448b64d825a28ab6789a157f46bf0882d881 |