Hi,
it would be nice to have a way to check if a user triggered the suspend action in Python scripts which always run in the background, to have the addon perform proper suspend actions.
I can think of something similar to xbmc.abortrequest, maybe an enhanced variant which scripts could read and do appropriate if/elif stuff. For compatibility reasons, xbmc.abortRequested should stay, of course.
Script-pseudocode of that idea:
Regards,
Daniel
it would be nice to have a way to check if a user triggered the suspend action in Python scripts which always run in the background, to have the addon perform proper suspend actions.
I can think of something similar to xbmc.abortrequest, maybe an enhanced variant which scripts could read and do appropriate if/elif stuff. For compatibility reasons, xbmc.abortRequested should stay, of course.
Script-pseudocode of that idea:
Code:
abortrequested = False
while not abortrequested:
# read in XBMC suspend/shutdown requests
# returns False when nothing requested
xbmcrequest = xbmc.getrequest()
if xbmcrequest:
if xbmcrequest == REQ_SUSPEND:
self.handleSuspend()
elif xbmcrequest == REQ_SHUTDOWN:
abortrequested = True
self.doAddonStuff()
sleep(10)
self.handleShutdown()
Regards,
Daniel