Skip to main content

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 file
  • light_parse(file_path): Parse metadata-related sections only
  • is_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 mapsets
  • save_mapsets_to_json(data, file_path): Export parsed data to JSON

Requirements

  • Python 3.8+

License

MIT License

Project details


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.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mania2json-0.1.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file mania2json-0.1.1.tar.gz.

File metadata

  • Download URL: mania2json-0.1.1.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

Hashes for mania2json-0.1.1.tar.gz
Algorithm Hash digest
SHA256 47cc0ea364d4de41f1e173bf182ba2b2573dfbd8d334a60f924c76b726716e0f
MD5 0f8aa4731ede2cf6c1e61d2f2f3cc9c1
BLAKE2b-256 ea408f2e93382a5898ff0396c87b02f866c88550c711c3e73b6b0976ba49bec5

See more details on using hashes here.

File details

Details for the file mania2json-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mania2json-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for mania2json-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a683c45ba01b1d8b096b67e2598f20fe76e23328ee6eb6682cebe4b46960879
MD5 01c1251b336d1b55f6745c5217c6588d
BLAKE2b-256 e39e2c81d07ff9575ecb462980295448d60c3bf5b0489ae47bcf78ce0be234d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page