Skip to main content

PyPi version

osrparse, a python parser for osu! replays

This is a parser for the .osr format for osu! replay files, as described by the wiki.

Installation

To install, simply:

pip install osrparse

Documentation

Please see the full documentation for a comprehensive guide: https://kszlim.github.io/osu-replay-parser. A quickstart follows below for the impatient, but you should read the full documentation if you are at all confused.

Quickstart

from osrparse import Replay, parse_replay_data
# parse from a path
replay = Replay.from_path("path/to/osr.osr")

# or from an opened file object
with open("path/to/osr.osr") as f:
    replay = Replay.from_file(f)

# or from a string
with open("path/to/osr.osr") as f:
    replay_string = f.read()
replay = Replay.from_string(replay_string)

# a replay has various attributes
r = replay
print(r.mode, r.game_version, r.beatmap_hash, r.username,
    r.replay_hash, r.count_300, r.count_100, r.count_50,
    r.count_geki, r.count_miss, r.score, r.max_combo, r.perfect,
    r.mods, r.life_bar_graph, r.timestamp, r.replay_data,
    r.replay_id, r.rng_seed)

# parse the replay data from api v1's /get_replay endpoint
lzma_string = retrieve_from_api()
replay_data = parse_replay_data(lzma_string)
# replay_data is a list of ReplayEvents

# write a replay back to a path
replay.write_path("path/to/osr.osr")

# or to an opened file object
with open("path/to/osr.osr") as f:
    replay.write_file(f)

# or to a string
packed = replay.pack()

# edited attributes are saved
replay.username = "fake username"
replay.write_path("path/to/new_osr.osr")

Download files

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

Source Distribution

osrparse-7.0.1.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

osrparse-7.0.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: osrparse-7.0.1.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for osrparse-7.0.1.tar.gz
Algorithm Hash digest
SHA256 61e160979c1d1a796a25e83b55effc07ddfadcb126a5cec28b2244cb1b48acdd
MD5 e4fb884710ceb253028708fea9fc5761
BLAKE2b-256 4e42c2f93b6fee9b92ac80b8b75724b79422bf5a63d6cb81aeacb63349ca7d4b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: osrparse-7.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for osrparse-7.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 84a0b3377d42751c3bea375b535dda0e71d90a8b378026f2f02b614553bb7163
MD5 7eb90ba154fb2707c80cedf1e8d7fa62
BLAKE2b-256 6aa4aa42de117b3b7460b1f83b6ed0578d0a086245db6e90f6d0503d2057d76f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

7.0.1 This release

2 files

7.0.0

2 files

6.0.2

2 files

6.0.1

2 files

6.0.0

2 files

5.0.0

2 files

4.0.1

2 files

4.0.0

2 files

3.0.0

1 file

2.1.0

1 file

2.0.2

1 file

2.0.1

1 file

1.0.2

1 file

1.0.1

1 file

0.2.2

1 file

0.2.0

1 file

0.1.2

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page