osu-replay-parser

Crates.ioosu-replay-parser
lib.rsosu-replay-parser
version0.2.0
sourcesrc
created_at2022-08-12 14:58:47.373075
updated_at2022-08-15 14:01:27.2146
descriptionOsu replay parser to use replay data in Rust projects
homepage
repositoryhttps://github.com/SailorSnoW/osr-parser/
max_upload_size
id644081
size162,213
Loïs (SailorSnoW)

documentation

README

Osu! replay parser for Rust

The project is currently in an early-development stage.

Please OPEN AN ISSUE if you encounter any problems using the library.


A Rust library to read, parse and write contained data of an Osu! score replay file to easily manipulate replays in a Rust project.

This library was made according how a replay file is structured explained on the official wiki of Osu! (https://osu.ppy.sh/wiki/en/Client/File_formats/Osr_%28file_format%29).

Usage

Parsing a replay from a file path

use osr_parser::Replay;

fn main() {
    let replay_path = Path::from("./assets/examples/replay-test.osr");

    let replay: Replay = Replay::open(&replay_path).unwrap();
    
    let player_name: String = replay.player_name;
    let is_a_full_combo: bool = replay.is_full_combo;
    let miss_count: u16 = replay.number_misses;
    let first_frame: ReplayFrame = replay.replay_data.frames[0];
}

Writing back a replay file from a replay data structure

use osr_parser::Replay;

fn main() {
    let replay_path = Path::from("./assets/examples/replay-test.osr");

    let replay: Replay = Replay::open(&replay_path).unwrap();
    
    let player_name: String = "New Player Name";
    
    replay.save("updated-replay.osr").unwrap();
}
Commit count: 12

cargo fmt