All Projects → garcia → simfile

garcia / simfile

Licence: MIT License
A modern simfile parsing & editing library for Python 3

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to simfile

stepmania-song-manager
Download and update song packs for StepMania with ease.
Stars: ✭ 23 (-11.54%)
Mutual labels:  stepmania, simfile
stepmania-server
Stepmania Server in python3
Stars: ✭ 20 (-23.08%)
Mutual labels:  stepmania
osukps
A keys-per-second meter for osu! (or any rythm game), useful for live streaming and making videos
Stars: ✭ 90 (+246.15%)
Mutual labels:  stepmania
piugba
🎮 PIU emulator for the GBA 🎮
Stars: ✭ 43 (+65.38%)
Mutual labels:  stepmania

simfile - for Python 3

A modern simfile parsing & editing library for Python 3.

Full documentation can be found on Read the Docs.

Features

Installation

simfile is available on PyPI:

pip3 install simfile

Quickstart

Load simfiles from disk using simfile.open or simfile.load:

>>> import simfile
>>> springtime = simfile.open('testdata/Springtime.ssc')
>>> springtime
<SSCSimfile: Springtime>
>>> with open('testdata/Kryptix.sm', 'r') as infile:
...     kryptix = simfile.load(infile)
...
>>> kryptix
<SMSimfile: Kryptix>

Use lowercase attributes to access most common properties:

>>> springtime.artist
'Kommisar'
>>> springtime.banner
'springbn.png'
>>> springtime.subtitle = '(edited)'
>>> springtime
<SSCSimfile: Springtime (edited)>

Alternatively, use uppercase strings to access the underlying dictionary:

>>> springtime['ARTIST']
'Kommisar'
>>> springtime['ARTIST'] is springtime.artist
True
>>> list(springtime.keys())[:7]
['VERSION', 'TITLE', 'SUBTITLE', 'ARTIST', 'TITLETRANSLIT', 'SUBTITLETRANSLIT', 'ARTISTTRANSLIT']

Charts are stored in a list under the .charts attribute and function similarly to simfile objects:

>>> len(springtime.charts)
9
>>> chart = springtime.charts[0]
>>> chart
<SSCChart: dance-single Challenge 12>
>>> list(chart.keys())[:7]
['CHARTNAME', 'STEPSTYPE', 'DESCRIPTION', 'CHARTSTYLE', 'DIFFICULTY', 'METER', 'RADARVALUES']

Developing

simfile uses Pipenv for dependency management. Activate the environment:

pipenv shell

To run the unit tests:

py -m unittest

To build the documentation:

docs/make html
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].