Probably in this day and age it would have better chance at adoption if it would be a JSON file. It's just network effects.
Probably in this day and age it would have better chance at adoption if it would be a JSON file. It's just network effects.
YAML is a superset of JSON, so the file can look like JSON if you want, although that's not mandatory. I don't think there are many languages that don't support YAML these days, and one of my goals was to make the format not-entirely-unreadable by humans.
YAML is a big and complex format though, libyaml's header is bigger than the entirety of libtoml.
I think hand-editable playlists are a good idea, just not a fan of yaml.
Ie yaml isn't nearly as supported as it looks once you start actually trying to use it between languages with anything more than 1.0 as most of the purported library support seemed to be roughly 2009 abandonware.
Yaml also precludes easy https://www.sqlite.org/json1.html and postgresql jsonb etc. Not to mention trivial js consumption of the file.
Superset or not, Yaml automagically introduces bugs to and from json through the magic powers of more lines of code involved.
Most projects would have a hard time not having a json library these days? I've not done a survey of music apps though.
In practice, as someone that has been vim/emacs for a few decades I'd put a low priority on yaml vs json text editability. They are about the same for changing a few characters and I'd probably use orgmode+ python to do anything non-trivial but not full program(and probably drive the transform via json data from somewhere...).
In 2017 yaml doesn't seem tasteful for this format.
However, with all the apprehension in the thread, I'm rethinking this decision. Maybe TOML would be better?
Toml is nice for simple configs/Cargo.toml but I think everything I said basically applies to it as well. Toml has recent work on it in 2017 for some (but not broad) library support but what does it look like in 2024?
TOML is a much simpler format than YAML, and is a dialect/formalisation of INI files which have yet to go out of style. Direct database storage seems like a red herring (why would you want to store a playlist as a json blob?), so does "trivial JS consumption of the file".
[0] the entire spec is 10 pages, and that's with lots of examples, YAML 1.2 is ~80 pages
While you are thinking maybe look at this
https://stedolan.github.io/jq/
and how people could leverage it when using your format.
And here I was feeling badly for thinking that it'd be better as S-expressions! I wasn't going to post that, but since you already did, here's the same example in the original YAML:
---
format: UPL1
name: Favorites
id: 2b43009f-d6a6-4f00-8533-09a9a73d8b54
entries:
- artist: Anciients
title: Following the Voice
duration: 408.764081632
ids:
sha2: e577cce68a69735acccd5d8603b3e663f6aa5bc9
sha3: e577cce68a69735acccd5d8603b3e663f6aa5bc9
mbtrackid: b00a2b97-53f1-485a-9121-1fe76b55e651
filepath: Anciients/Following the Voice.mp3
uri: nfs://example.com/music/ftv.mp3
as JSON: {
"format": "UPL1",
"name": "Favorites",
"id": "2b43009f-d6a6-4f00-8533-09a9a73d8b54",
"entries": [
{
"artist": "Anciients",
"title": "Following the Voice",
"duration": 408.764081632,
"ids": {
"sha2": "e577cce68a69735acccd5d8603b3e663f6aa5bc9",
"sha3": "e577cce68a69735acccd5d8603b3e663f6aa5bc9",
"mbtrackid": "b00a2b97-53f1-485a-9121-1fe76b55e651",
"filepath": "Anciients/Following the Voice.mp3",
"uri": "nfs://example.com/music/ftv.mp3"
}
}
]
}
And as S-expressions: (playlist
(format UPL1)
(name Favorites)
(id 2b43009f-d6a6-4f00-8533-09a9a73d8b54)
(entries
(entry
(artist Anciients)
(title "Following the Voice")
(duration 408.764081632)
(ids
(sha2 e577cce68a69735acccd5d8603b3e663f6aa5bc9)
(sha3 e577cce68a69735acccd5d8603b3e663f6aa5bc9)
(mbtrackid b00a2b97-53f1-485a-9121-1fe76b55e651)
(filepath "Anciients/Following the Voice.mp3")
(uri nfs://example.com/music/ftv.mp3)))))
I wonder which in general people think are prettier.