2016-06-16, 12:57
(2016-06-16, 02:21)rroos Wrote: So I've wrote a Python script that can monitor network usage, and I want to execute the script when the 'shutdown' event kicks in. The idea is that the script determines if there is network activity and if so, prevent the shutdown from taking place.
But I'm having problems getting that to work. I'm pretty confident about the script, and I'm presuming it gets executed, but I'm also presuming that nothing is preventing Kodi from executing the actual Suspend action while the script is being executed: the script probably doesn't replace the Kodi action. Are there ways in the plugin to prevent Kodi from executing the actual event?
There is no way to 'abort' Kodi's shutdown. If your code doesn't exit in 5 seconds, Kodi kills the thread it is executing in.
To my knowledge, there is no way around this. Even for the hardcore python developers, it makes debugging shutdown code challenging.