Modifying keyboard, complex issue

Basically, I need to add a complex command to the Remote control. I can enter command to the script and map script at remote.xml. If someone tells me how, it is a plus, but that is not a problem.

Problem is: I must change a way “Record now” command is handled so it would first mount my disk and only then try to record. If I create recording that starts at now+5 minutes, all is well.

Instead of remote sending KEY_RECORD pressed to the Kodi, I would like to change resulting <record> into: mount my disk, and then <record>. Is that possible?

I am hoping someone would give me a better idea Smile With this, I can make separate key meaning “Record now”. Not perfect, but acceptable.

Explanation. I use RPi LibreElec as TVHeadend server for Live TV. NAS is mounted as disk for recording. If NAS goes to sleep, LE breaks. LE will hang RPi if OS level mount is or becomes unavailable! No mount command can solve that at LE RPi.

I made a script to check TVheaend recordings and wake my server, mount if needed, umount if no recordings are pending. But, as it is run by cron, I have a gap of 5 minutes before my script can notice a recording is added to the TVH. Even If I run it every 1 minute, it would not help.

Ideally, I would tap into TVheadend to inform me someone just added a recording, and do what needs to be done. I did not find a way to do so.

But, if I change a Record now command into mount+record…