Skip to content

mkpoli/sus-io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sus-io

A SUS (Sliding Universal Score) parser and generator.

Project Status: Active – The project has reached a stable, usable state and is being actively developed.

Functionality

  • Parse sus into tick-based objects.
  • Allow json output.

Usage

sus.loads(data: str)

import sus

print(sus.loads("#00002: 4\n#BPM01: 120\n#00008: 01"))

sus.load(fp: TextIO)

import sus

with open("score.sus", "r") as f:
    score = sus.load(f)
    print(score)

Score(...).to_json(...), Score.from_json(...)

import sus
from sus import Score

with open("score.sus", "r") as fi, open("score.json", "w") as fo:
    score = sus.load(fi)
    json = score.to_json(indent=4)
    fo.write(json)

    print(Score.from_json(json))

sus.dump(score: Score), sus.dumps(score: Score)

import sus

with open("score.sus", 'r') as fi, open(sus_file.with_suffix('.dumped.sus'), 'w') as fd:
    score = sus.load(fi)
    print(sus.dumps(score))
    sus.dump(score, fd, comment='Custom comment.', space=False)

Todo

  • Acknowledgement
  • Add example I/O
  • Contribution Guide
  • High Speed
  • etc.

Links

Javascript

License

MIT © 2021 mkpoli

About

A SUS (Sliding Universal Score) parser and generator.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages