TobKra96 / music_led_strip_control

Audio visualization for LED strips in real-time with web interface on a raspberry pi.
https://tobkra96.github.io/music_led_strip_control/
MIT License
298 stars 64 forks source link

Change Configuration File Path #64

Closed TobKra96 closed 3 years ago

TobKra96 commented 3 years ago

Change the path of the config file to "/share/.mlsc"

Do we need the music_led_strip_control/server/libs/config.json any more? We can create our config if it is missing from the template music_led_strip_control/server/libs/config.json.bak.

We have to adjust the import and export mechanism inside the webinterface. https://github.com/TobKra96/music_led_strip_control/blob/9e67a3b1e90bb417c7778d1667b08f1c437d23a5/server/libs/webserver.py#L26

Teraskull commented 3 years ago

Nope, I just left it for compatibility right now.

Teraskull commented 3 years ago

Instead of copying config.json:

https://github.com/TobKra96/music_led_strip_control/blob/9e67a3b1e90bb417c7778d1667b08f1c437d23a5/server/libs/config_service.py#L21

We can copy config.json.bak.

Anyways, copying the config will ensure that during reinstallation it won't be touched.

TobKra96 commented 3 years ago

Yes, we have to take care of the compatibility of the new config files. If there is a new effect with new settings, the old config file could cause errors.

Additionally, maybe we can use relative paths? Absolute paths are usually no good ideas. What do you mean?

Teraskull commented 3 years ago

Yes, and a config backup system would be good.

TobKra96 commented 3 years ago

I would split the Topics:

@Teraskull:

@TobKra96:

What do you think? Have a great day.

Teraskull commented 3 years ago

I don't think we need a backup, saving the previous config.json as config.json.bak would be enough.

TobKra96 commented 3 years ago

config.json.bak is the config, we are using for the reset. If everything went wrong, he should able to start from scratch. I would not change it. Maybe we can use another name for the user backup. Or save the user backup inside the .mlsc folder?

Teraskull commented 3 years ago

That's what I meant, create a backup with config.json.bak in .mlsc.

TobKra96 commented 3 years ago

Ok, I was not sure. Yes, that would work.

TobKra96 commented 3 years ago

I added a compatibility checker, which checks every config leaf (recursive) if it exists and set the default value if it does not exist. It worked better than I thought. The config will be checked during the start and after an import.

Teraskull commented 3 years ago

Perfect, no more manual copying of new effects after updating :D

TobKra96 commented 3 years ago

Done Maybe we will find a better folder for the config in the future, but for now, it is done.