Parser for osr files and lzma replay streams for osu!
Project description
osrparse, a python parser for osu! replays
This is a parser for osu! replay files (.osr) as described by https://osu.ppy.sh/wiki/en/osu%21_File_Formats/Osr_%28file_format%29.
Installation
To install, simply:
pip install osrparse
Documentation
To parse a replay from a filepath:
from osrparse import parse_replay_file
# returns a Replay object
parse_replay_file("path/to/osr.osr")
To parse a replay from an lzma string (such as the one returned from the /get_replay
osu! api endpoint):
from osrparse import parse_replay
# returns a Replay object that only has a `play_data` attribute
parse_replay(lzma_string, pure_lzma=True)
Note that if you use the /get_replay
endpoint to retrieve a replay, you must decode the response before passing it to osrparse, as the response is encoded in base 64 by default.
Replay objects provide the following fields:
self.game_mode # GameMode enum
self.game_version # int
self.beatmap_hash # str
self.player_name # str
self.replay_hash # str
self.number_300s # int
self.number_100s # int
self.number_50s # int
self.gekis # int
self.katus # int
self.misses # int
self.score # int
self.max_combo # int
self.is_perfect_combo # bool
self.mod_combination # Mod enum
self.life_bar_graph # str, currently unparsed
self.timestamp # datetime.datetime object
self.play_data # list[ReplayEvent]
ReplayEvent objects provide the following fields:
self.time_since_previous_action # int (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
Release history Release notifications | RSS feed
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
File details
Details for the file osrparse-4.0.1.tar.gz
.
File metadata
- Download URL: osrparse-4.0.1.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ba2f279142bd3d9160a8f0693f100693050e29167bb8687d0343b3faf0c59c4 |
|
MD5 | 5ed9c885d791424b29ec3bab47426bec |
|
BLAKE2b-256 | 5d6394e315d2fc5bcafec8676d4176e06266e3f5622956eabc1dfb9e60199ba7 |
File details
Details for the file osrparse-4.0.1-py3-none-any.whl
.
File metadata
- Download URL: osrparse-4.0.1-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22d0d39be9f0cabe695b3b6705ea9597553a7f53df37471bc75f0c482b0f684e |
|
MD5 | 123a1e95b31fe236949855dcae95217e |
|
BLAKE2b-256 | 48b308130f49b865e8b6a36ded2902eab7f659bc2b45f8f213cdff318e24868f |