Developers
OnSong® Binder File Format
Th’ OnSong® app has been pivotal in helpin’ music crews move away from paper charts an’ sheet music. In th’ process, we’ve helped musicians t’ ditch th’ binder. No longer be ye chained t’ 3-rings an’ a hole punch. But much like most technological advances, this convenience creates another challenge. How can we transfer digital versions o’ charts, sets, an’ even books in an easy, cross-platform file format? Arrr, enter OnSong® Binder!
What be OnSong® Binder?
OnSong® Binder be a file format available in OnSong 2026.2 an’ higher that uses th’ *.onsongbinder file extension an’ assumes th’ “application/onsong-binder” MIME type. It’s a simple ZIP file that contains a structured file hierarchy an’ files that let it ferry many types o’ information across th’ seas. This information can then be compressed an’ uncompressed as needed, its contents traversed, its objects serialized an’ deserialized, an’ data files included. Let’s take a look at some ways that an OnSong® Binder file can be constructed, matey!
File System
Every voyage has t’ start somewhere, so we’ll weigh anchor at th’ root. These be th’ files or folders that be contained at th’ root o’ th’ data structure. These can be folders or files. Folders can represent individual objects or data, or collections o’ data. Here’s how t’ know th’ difference:
Objects
Objects be stowed in a folder with th’ object’s identifier. In addition, th’ contents o’ that folder contain a “manifest.json” file. This be a JSON (JavaScript Object Notation) file holdin’ information that can be deserialized into class-based objects on either end o’ th’ voyage.
Collections
Collections contain folders which in turn contain object data by includin’ a “manifest.json” file. When an object has children, those collections be stowed in separate folders that reference th’ name o’ th’ collection. For instance, a set would have a “songs” folder which contains multiple folders, each folder representin’ individual song objects, arrr!
Takin’ that knowledge means that our OnSong® Binder file can contain a single root object, or could contain a collection o’ objects. For instance, if ye be sendin’ a set list o’ songs, ye could include a “manifest.json” file at th’ root that contains information about th’ set. Ye could then include a “songs” folder that references objects contained in th’ setlist’s songs collection, an’ then each object would be a folder therein like this…
Manifest File
Th’ manifest.json file be a JavaScript Object Notation formatted file which lets it sail with a variety o’ platforms. This contains th’ information necessary t’ stow data about th’ object an’ recreate th’ object in th’ implementation. In addition t’ name/value pairs in th’ JSON file, these specific binder-specific properties be also available:
$binder.ID
This be th’ unique identifier o’ th’ object an’ should match th’ name o’ th’ containin’ folder.
$binder.class
This be th’ name o’ th’ class o’ th’ object that has been serialized. Typically th’ bindin’ process will normalize class names such that they omit any app-specific namespaces or prefixes. For instance, while th’ OnSong® app uses a class called “OSBook”, th’ class be simplified t’ simply “Book”. Th’ classes supported by th’ OnSong® Binder file format include “Set”, “Book”, “Song”, an’ “SongAttachment”.
$binder.assembledOn
This be th’ date/time in ISO 8601 format that th’ object an’ th’ binder was assembled.
$binder.collectionName
Most o’ th’ time, objects that be serialized can have other children or related objects associated t’ them. For instance, a Set has songs that must be listed in a specific order an’ a Song has attachments that can contain files used t’ display th’ song in different ways. Th’ collection property would be th’ name o’ th’ collection such as “$binder.songs”.
Th’ portion o’ th’ property name after th’ “$binder.” prefix directly relates t’ th’ name o’ th’ folder in which those objects reside. In this example, th’ Set folder would contain a “songs” folder that in turn contains individual files fer each song. Th’ collection property would contain a reference t’ th’ related item as well as its class as an object with th’ followin’ properties:
$binder.ref
This be a URI that references th’ object, includin’ th’ name o’ th’ container folder an’ th’ name o’ th’ object’s folder.
$binder.class
This would be th’ name o’ th’ object’s class, savvy?
For instance, if th’ Song object we be referencin’ has a unique identifier o’ SONG_IDENTIFIER_1, it would contain th’ followin’ element in th’ collection:
{“$binder.ref” : ”songs/SONG_IDENTIFIER_1”, “$binder.class” : ”Song”}
When processin’ this file, ye may opt t’ remove these keys afore usin’ it in yer own class files if ye so desire, matey.
Files
Th’ OnSong® Binder file format be designed t’ also stow files. This may be used if ye reference a binary or text-based file in yer object. For instance, a Song can have multiple attachments which contain files that can be viewed. Th’ OnSong® Binder be assembled t’ include these files when a specific property containin’ a reference t’ th’ file be encountered.
For instance, th’ SongAttachment object has a “filename” property that references a file. In addition, this object class points t’ th’ file within th’ main application. Th’ binder assembly process copies th’ file that be referenced into th’ bindin’ folder adjacent t’ th’ attachment’s “manifest.json” within th’ Song’s folder. We can then find th’ file fer th’ individual attachment usin’ th’ “filename” property, savvy?
Examples
Blimey, this could be a lot t’ comprehend, but we feel th’ OnSong® Binder file format be quite simple t’ implement. Th’ best way t’ learn how th’ OnSong® Binder works be through th’ included examples fer multiple songs, single songs, a set, an’ book t’ see how OnSong handles each. Ye can uncompress these as ZIP files t’ inspect th’ treasure inside: