Modern simfile library for Python
Project description
A modern simfile parsing & editing library for Python 3.
Features
- Supports both SM and SSC files
- Format-agnostic API for reading & writing simfiles
- SM ↔︎ SSC conversion
- Timing data support
- Beat ↔︎ song time conversion
- Handles BPM changes, stops, delays and warps
- Accepts "split timing" from SSC charts
- Note streams from charts
- Algorithms for grouping jumps & hold/roll head/tail notes
- Flexible note counting functions
- Timing data integration
- Fully typed & documented API
Installation
simfile is available on PyPI. During the current beta phase, make sure to pass --pre
to pip
, otherwise you will fetch the 1.0 release:
pip3 install --pre simfile
Version 2.0 is a substantial departure from the 1.0 release. Read Migrating from simfile 1.0 to 2.0 for a breakdown of the changes. While 2.0 is currently in beta, no further breaking API changes are anticipated before the official 2.0 release.
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']
Further reading
Full documentation can be found on Read the Docs.
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
Built Distribution
Hashes for simfile-2.0.0b7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 797058a0d4fd8d1576849d1c7864a4e6d062caa56723f5d8a4377e51c53a7a14 |
|
MD5 | bc389043b921760feb1a82af7442e72f |
|
BLAKE2b-256 | 8f8d1289c6a2250e1c9f3f42f9faff06daaabf8c65c884485fd5e98dcf8615e3 |