fv1-programs
fv1-programs copied to clipboard
programs.json
Hello,
I'm the author of https://github.com/eh2k/fv1-emu. I'm thinking about to integrate your great collection of fv1-programs into the VCV-Rack Module, so the user can get/use the programs from https://mstratman.github.io/fv1-programs/ without using the browser.
The programs.js has exactly the data I need (category, controls etc).
Unfortunately the file is a JavaScript and it cannot be directly used in the C++ environment.
If you could provide a "programs.json" or change the programs.js to json, it would make the integration easier.
Hi. I originally had this file as a JSON file but it was too inconvenient to work with, since it's primarily hand-edited. I switched it to ES6 to avoid worrying about quoting and comma rules.
If you write a script to ...
- quote all the object keys, and
- clean up stray trailing commas, and
- convert multi-line backtick quoted strings to single line double quotes,
...it should validate as JSON. Assuming it does, I can commit to ensuring never to add other content that won't work for json (i.e. not take advantage of other ES6 features)
That's outside the scope of what I'm going to do for this project though.
That is a really cool project, by the way. I'm looking forward to trying it out!
By the way, this should be quick and easy with a little ES6 cli program, but I'm fighting with babel right now and it's not working. I'll give it another pass soon. Once put together, though, it'd just be a couple line script.
Hi, thank you for your hint. I have found a nice solution right now. I'm using a github action cron pipeline, for fetching your repository. Here is the nodejs script:
https://github.com/eh2k/fv1-emu/blob/fv1-programs/fetch_programs.js
The script does:
- Executing your programs.js with 'eval'.
- Filter out program entries without "spn"-download (maybe I will implement other file types later)
- Downloading the spn-files and adding as base64 content
- Save programs.json with the spn-file-contents.
- gziping the programs.json
At the end there is a "programs.json.gz" with a size of 187KB containing 162 programs.
https://github.com/eh2k/fv1-emu/tree/gh-pages
PS: I was thinking, if you wouldn't mind, adding something like this into your build-script - so I could fetch the json directly from "https://mstratman.github.io/fv1-programs/programs.json":
var s = await fetch("https://raw.githubusercontent.com/mstratman/fv1-programs/master/programs.js");
eval(s.replace("export default", "var programs = "));
fs.writeFile('programs.json', JSON.stringify(programs, null, "\t"), function (err) {});
I was thinking, if you wouldn't mind, adding something like this into your build-script - so I could fetch the json directly from "https://mstratman.github.io/fv1-programs/programs.json":
That's a really good idea. Reopening since that would solve both both projects well.