I’m currently working on a plugin for Volumio to make it possible to change volume from UI after replacing ALSA with PulseAudio (topic posted, pending moderation). I’ve had a look at the code of Volumio, and found a rather shady, but appropriate functionality to provide custom volume change scripts to VolumeController module. However, due to how plugins engine is designed, I’m not able to access VolumeController either from onVolumioStart() or onStart() callbacks as it is not yet initialized and attached to CoreCommandRouter (while, mistakenly, I had access to it at initial development stage, as I’ve installed the plugin during Volumio normal work, and at that stage CoreCommandRouter is fully initialized).
My question is to the lead devs of Volumio, is there any specific reason why plugin initialization is done in the middle of Volumio startup instead of at the end when everything is fully initialized?
There are three possible solutions I see right now for my problem:
- move plugin initialization to the end of CoreCommandRouter initialization method
- create a “boot completed” event and call callbacks at the end of initialization, then register a callback for that event in my plugin and then access VolumeController module as it’s initialized at that time
- create same event as above, but attach to it a new dedicated module for plugin initialization - this way, plugins will get started after system successfully booted up (BTW, currently, if any plugin throws an error during init, whole Volumio startup fails - bummer!)
Please let me know your thoughts.