osrparse


Nameosrparse JSON
Version 7.0.0 PyPI version JSON
download
home_page
SummaryParser for osr files and lzma replay streams for osu!
upload_time2023-05-10 23:17:17
maintainer
docs_urlNone
author
requires_python
license
keywords osu! osr replay replays parsing parser python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            [![PyPi version](https://badge.fury.io/py/osrparse.svg)](https://pypi.org/project/osrparse/)

# osrparse, a python parser for osu! replays

This is a parser for the ``.osr`` format for osu! replay files, as described by [the wiki](https://osu.ppy.sh/wiki/en/Client/File_formats/Osr_%28file_format%29).

## Installation

To install, simply:

```sh
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

```python
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")
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "osrparse",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "osu!,osr,replay,replays,parsing,parser,python",
    "author": "",
    "author_email": "Kevin Lim <kszlim@gmail.com>, Liam DeVoe <orionldevoe@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/bf/67/f9839c9149dabf7d4ca485d0a5e86758842f9b41ed4f3e4e97b52cd3530e/osrparse-7.0.0.tar.gz",
    "platform": null,
    "description": "[![PyPi version](https://badge.fury.io/py/osrparse.svg)](https://pypi.org/project/osrparse/)\n\n# osrparse, a python parser for osu! replays\n\nThis is a parser for the ``.osr`` format for osu! replay files, as described by [the wiki](https://osu.ppy.sh/wiki/en/Client/File_formats/Osr_%28file_format%29).\n\n## Installation\n\nTo install, simply:\n\n```sh\npip install osrparse\n```\n\n## Documentation\n\nPlease 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.\n\n### Quickstart\n\n```python\nfrom osrparse import Replay, parse_replay_data\n# parse from a path\nreplay = Replay.from_path(\"path/to/osr.osr\")\n\n# or from an opened file object\nwith open(\"path/to/osr.osr\") as f:\n    replay = Replay.from_file(f)\n\n# or from a string\nwith open(\"path/to/osr.osr\") as f:\n    replay_string = f.read()\nreplay = Replay.from_string(replay_string)\n\n# a replay has various attributes\nr = replay\nprint(r.mode, r.game_version, r.beatmap_hash, r.username,\n    r.replay_hash, r.count_300, r.count_100, r.count_50,\n    r.count_geki, r.count_miss, r.score, r.max_combo, r.perfect,\n    r.mods, r.life_bar_graph, r.timestamp, r.replay_data,\n    r.replay_id, r.rng_seed)\n\n# parse the replay data from api v1's /get_replay endpoint\nlzma_string = retrieve_from_api()\nreplay_data = parse_replay_data(lzma_string)\n# replay_data is a list of ReplayEvents\n\n# write a replay back to a path\nreplay.write_path(\"path/to/osr.osr\")\n\n# or to an opened file object\nwith open(\"path/to/osr.osr\") as f:\n    replay.write_file(f)\n\n# or to a string\npacked = replay.pack()\n\n# edited attributes are saved\nreplay.username = \"fake username\"\nreplay.write_path(\"path/to/new_osr.osr\")\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Parser for osr files and lzma replay streams for osu!",
    "version": "7.0.0",
    "project_urls": {
        "Homepage": "https://github.com/kszlim/osu-replay-parser"
    },
    "split_keywords": [
        "osu!",
        "osr",
        "replay",
        "replays",
        "parsing",
        "parser",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "168f8eed1611932773b38d7dc5fe319889f7bd6e9305ea870eb6795d996aa651",
                "md5": "d1848be4e09978a32c2ece3bfac52313",
                "sha256": "562dd4d53bb0c9cb00ac17269822da57e9d2712b06af4ecd8f665b9335b161e2"
            },
            "downloads": -1,
            "filename": "osrparse-7.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d1848be4e09978a32c2ece3bfac52313",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9451,
            "upload_time": "2023-05-10T23:17:14",
            "upload_time_iso_8601": "2023-05-10T23:17:14.384894Z",
            "url": "https://files.pythonhosted.org/packages/16/8f/8eed1611932773b38d7dc5fe319889f7bd6e9305ea870eb6795d996aa651/osrparse-7.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bf67f9839c9149dabf7d4ca485d0a5e86758842f9b41ed4f3e4e97b52cd3530e",
                "md5": "51353e97c7e3e45a7bcee6cc4be61860",
                "sha256": "5c7b61f73bede496d92357b2c6299613c07ee5baf1b37be318a60306db3812a5"
            },
            "downloads": -1,
            "filename": "osrparse-7.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "51353e97c7e3e45a7bcee6cc4be61860",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11047,
            "upload_time": "2023-05-10T23:17:17",
            "upload_time_iso_8601": "2023-05-10T23:17:17.269891Z",
            "url": "https://files.pythonhosted.org/packages/bf/67/f9839c9149dabf7d4ca485d0a5e86758842f9b41ed4f3e4e97b52cd3530e/osrparse-7.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-10 23:17:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kszlim",
    "github_project": "osu-replay-parser",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "lcname": "osrparse"
}
        
Elapsed time: 0.08086s