Monday | 15 APR 2024
[ previous ]
[ next ]

Dynamic Configuration Files

Date: 2022-01-23

I'm still doing some work on a download script that will download videos for my mom without ads. She watches a number of dramas on TV but sometimes she'll miss episodes because of work and the sketchy streaming sites are all ad ridden. Which fair, they do have bills to pay but I already pay for a streaming site that adds ads anyway. Though 100% I am stealing.

Anyway! The ethics of ads, streaming and piracy aside, I wrote the script such tat it'd be easy to add a new show and originally I wrote it in javascript as an array of objects. This ended up being really helpful as I could do any sort of programming such as generating dates in the right format so the configuration is dynamic. This seems like a step up from using a plain json file or toml file. I wonder why we don't use more dynamicness in configuration languages. I'm guessing it would be a vector of attack but there shouldn't be user input in configs anyway.

So far I'm happy with the configuration object being in javascript as it lets me generate URLs easily. Otherwise I would need to add another step of parsing pages for URLs.

Template strings in javascript are fantastic. I've done so much string concatenation before that template strings makes simple now. Probably one of the largest quality of life improvements I've noticed in javascript.