A Python library for parsing osu!mania 4k beatmap files
Project description
mania2json
A Python library for parsing osu!mania 4k beatmap files and extracting relevant information.
Features
- Parse osu!mania beatmap (.osu) files
- Extract metadata, difficulty settings, hit objects, and timing points
- JSON exports
Installation
pip install mania2json
Quick Start
from mania2json import mania_file_parser, mania_mapset_parser
# example use with a single file
maniap = mania_file_parser()
maniap.light_parse(file_path="xi - .357 Magnum (Akali) [4K Hyper].osu")
print(maniap.__dict__)
# example use with a songs directory
dir = "C:\\Users\\phile\\AppData\\Local\\osu!\\Songs\\"
parser = mania_mapset_parser()
mapset_data = parser.get_mania_mapsets_from_folder(directory=dir, max_workers=1)
print(f"Found {len(mapset_data)} mania mapsets in {dir} ({sum(len(maps) for maps in mapset_data.values())} maps)")
# save all mapsets to a single JSON file
parser.save_mapsets_to_json(mapset_data, "all_mapsets.json")
# ...or save individual mapsets in multiple files
for mapset_id, mapset_content in mapset_data.items():
parser.save_mapsets_to_json({mapset_id: mapset_content}, f"songs\\{mapset_id}.json")
API Reference
mania_file_parser
full_parse(file_path): Parse all sections of a beatmap filelight_parse(file_path): Parse metadata-related sections onlyis_4k_map(): Check if the beatmap is a 4K mania map
mania_mapset_parser
get_mania_mapsets_from_folder(directory, max_workers=8): Scan directory for mania mapsetssave_mapsets_to_json(data, file_path): Export parsed data to JSON
Requirements
- Python 3.8+
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mania2json-0.1.0.tar.gz
(6.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mania2json-0.1.0.tar.gz.
File metadata
- Download URL: mania2json-0.1.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de60f168f69cbf7a821bc4cc405714fccbb23e59c781c0791fc3efe3f44eaafb
|
|
| MD5 |
a5fc653e680085c3b96001e1e9186c87
|
|
| BLAKE2b-256 |
7d3ec979d87317e1917854f18c5c4829c330d943e3fb0c715e65b28bcd1331e8
|
File details
Details for the file mania2json-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mania2json-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af5495e744358d38ea42c44a2fc7f967a43c532603122ecda10784cae9494ae6
|
|
| MD5 |
fe4cb22cb682002e64ae75bbb8ee6888
|
|
| BLAKE2b-256 |
5c1b0ee526a24f9aea9e5ad3986521bf83ccda98df96526aabb5918629a925eb
|