endkb / SoundsDownloadScript

Download programs from BBC Sounds and publish them to a podcast feed
2 stars 0 forks source link

Store variables in external file #1

Closed endkb closed 6 months ago

endkb commented 6 months ago

Right now, "script-wide" variables are stored at the top of the .ps1. If the script version gets updated, the values need to be transcribed.

Ini file might be a good option, there's already a function in the script to do that. It might need to be moved to a different section.

I don't know how an ini file would work with the remote script blocks.

endkb commented 6 months ago

For SoundsDownloadScript, I'm thinking about just allowing dot sourcing a config file from an external .ps1. It's not graceful, but the script blocks for rclone would be a nightmare to convert to another format like xml, json, or ini. I do consider those user configurable items, even though they are more advanced than just changing a simple variable. External file would basically look like the config options in the main script. It would be called with a command line arg.

For genRSS, I might move debug and debugdirectory into the profile files. That only leaves kid3 and rclone locations. Those are easy to set if the script gets updated. genRSS doesn't get updated very often anyway.

Edit: I did some additional reading and ini files can't really do multiline values that would be needed for the script blocks to configure rclone.

endkb commented 6 months ago

A downside is that debug logging can't start until the config files are read, so if there's a config file problem, they won't be logged.

Just about everything is in place, I just don't know if I'm ready to pull the trigger on external config files, especially the dot sourcing in the SoundsDownloadScript because it seems so dirty. I don't really know why though, it's no different than modifying the configuration options inline...

endkb commented 6 months ago

Merged into main. Needs testing.

endkb commented 6 months ago

I'm satisfied that it works.