Skip to main content

Parser for osr files and lzma replay streams for osu!

Project description

PyPi version Build Status

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

osrparse-4.0.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

osrparse-4.0.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file osrparse-4.0.0.tar.gz.

File metadata

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

File hashes

Hashes for osrparse-4.0.0.tar.gz
Algorithm Hash digest
SHA256 059ab2ba2ebc36587e41c98ee61b32601af4b435a40f5ca8de176df06a66e9e9
MD5 dae35570ba76bbe2b73c9881ad9909c0
BLAKE2b-256 12187be6e515027899a92a6c4b055540c898c50b350bbe612c20419bf1ab63f0

See more details on using hashes here.

File details

Details for the file osrparse-4.0.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for osrparse-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eecaf913b0de392aa935f7b64a6cccfa59dea1a356a8d986f29798807abf3a2f
MD5 3f3dd87dd34df73604e3f2e62fce664f
BLAKE2b-256 215adc818eacace439b7807f1b1778f0e2a6a857c7f8d1a562e11bdefd07fda8

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