Req Python: Suspend/Resume handling for Scripts
#1
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:

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
script.xbmc.lcdproc!
Leia+VAAPI+HD-Audio+LCDproc addon,TVHeadend-master/DVB-C/T2+pvr.tvh addon on Ubuntu 18.04 (amd64)
Reply

Logout Mark Read Team Forum Stats Members Help
Python: Suspend/Resume handling for Scripts0