Skip to content

roansong/osu-replay-parser

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

osrparse, a parser for osu replays in Python

This is a parser for osu! rhythm game replays as described by https://osu.ppy.sh/wiki/Osr_(file_format)

Installation

To install osrparse, simply:

$ pip install osrparse

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(byteString)

To check for a gamemode:

from osrparse.enums import GameMode
if replay.game_mode is GameMode.Standard:
  print("This is GameMode Standard indeed!")

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.

About

Parser for osr (osu! replays) file format

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%