Skip to main content

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 git+git://github.com/tybug/osu-replay-parser

Documentation

To parse a replay from a filepath:

from osrparse import parse_replay_file

#returns instance of Replay
parse_replay_file("path/to/osr.osr")

To parse a replay from a bytestring:

from osrparse 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

circleparse-5.0.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

circleparse-5.0.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file circleparse-5.0.0.tar.gz.

File metadata

  • Download URL: circleparse-5.0.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

File hashes

Hashes for circleparse-5.0.0.tar.gz
Algorithm Hash digest
SHA256 6f1904ef851f9561473bac7b3490fa3e809b2ab6dad4fcc7ec59c32ab0deb19e
MD5 d27a23d44872be9daa4181d09d8c4b6a
BLAKE2b-256 fcf8522a9b59379c946ec0c40403ee7dacb4d423d7b6eee863ceb03bc1381125

See more details on using hashes here.

File details

Details for the file circleparse-5.0.0-py3-none-any.whl.

File metadata

  • Download URL: circleparse-5.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2

File hashes

Hashes for circleparse-5.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe1befa3ec33eb5d8c75a6e0a9f9bb0d20ee701a165fcca58b1b81ac626a5f15
MD5 62de1aaa8ad6d04beb980ae4f9db476c
BLAKE2b-256 5051754fafcfeb4c6ca295c0293e0994f22e104fe31171119573bf9b0c3fb492

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page