icemac.songbeamerPython 3 library to import from and export to SongBeamer format | |
Download |
icemac.songbeamer Ranking & Summary
Advertisement
icemac.songbeamer Tags
icemac.songbeamer Description
icemac.songbeamer is a Python library to read and write SongBeamer files.UsageImporting a .sng fileTo import a .sng file use the parse class method. It expects a byte stream (io.BytesIO or open file) as argument to read from: >>> from icemac.songbeamer import SNG >>> with open('example.sng', 'rb') as file: ... sng = SNG.parse(file)The parsed data is stored in the data attribute of the object: >>> sng.data {'Text': , 'Version': 3, 'Author': 'me'}To access the raw values imported from the .sng file get them using getattr: >>> sng.Version b'3'Exporting a .sng file >>> from pprint import pprint >>> from tempfile import TemporaryFileTo export to a .sng file use the export method. It expects a byte stream (io.BytesIO or open file) as argument to write into: >>> with TemporaryFile() as file: ... sng.export(file) ... pprint(file.readlines()) Product's homepage
icemac.songbeamer Related Software