I'd like to create a number of Liquidsoap sources with the same script but with a few variables e.g. station name.
I've seen that I can include a config.liq, for example, but it would be nice if I could read my configuration parameters from something not tied to the language, such as JSON. Liquidsoap has an of_json
function but I'm unclear how I can read from a JSON file rather than a JSON string.
What can I do to have an configuration file that is not tied to the scripting language?
Good question. I don't have exact code for you, but I've actually been able to read from HTTP by shelling out to cURL. (And then, I found the built-in functions for HTTP requests, but those don't apply to your case I don't think.)
If you can't find a command to read a file directly, just use system()
with a call to cat
to dump the file.