osu! Parse Replay
Source
The source is a string that describes the source of the replay. which can be either file
, api
, infer
.
For example
from reamber.algorithms.osu.parse_replay import parse_replay_actions
parse_replay_actions("path/to.osr", src="file", keys=7)
import os
import requests
from reamber.algorithms.osu.parse_replay import parse_replay_actions
# API stream parsing
url = f'https://osu.ppy.sh/api/get_replay?k={os.environ["osu_api_key"]}&s=123456&m=3'
response = requests.get(url)
parse_replay_actions(response.json()['content'], src='api', keys=4)
Parse Replay Actions Return
DataFrame schema
- offset
The offset of the action in ms.
- column
The column that the action is on.
- is_press
Whether the action is a press or release.
Replay Error
We use the absolute minimum distance to match each replay action to its respective expected action in the map.
from reamber.algorithms.osu.parse_replay import parse_replays_error
from reamber.osu import OsuMap
df_errors = parse_replays_error(
replays={"rep1": "path/to1.osr", "rep2": "path/to2.osr"},
osu=OsuMap.read_file("path/to.osu"),
src="file"
)
The replays
argument must be a dictionary, with key as the identifier for the returned index. Think of the keys as the identifier of the replays.
Replay Error Return
DataFrame schema
- replay_id
The identifier of the replay.
- offset
The offset of the action in ms.
- column
The column that the action is on.
- is_press
Whether the action is a press or release.
- error
The error in ms.
Last modified: 23 March 2024