Kodi Community Forum

Full Version: xbmc.Monitor().abortRequested()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have an addon with a service, the service run while a user is logged in using this in the addon.xml

Code:
<extension point="xbmc.service" library="service.py" start="login">

The service should be running all the time while the user is logged into Kodi.

I was told to use the in my service loop

Code:
xbmc_monitor = xbmc.Monitor()
while not xbmc_monitor.abortRequested():
   <do servisy stuff here>
   xbmc_monitor.waitForAbort(1)

However, I have noticed that .abortRequested() can return true when an addon action is stopped, i.e. you call the addon to show a list if ListItems and as it is doing that you hit backspace, this cansels the addon call but triggers a global abort requested action which triggers the service monitor instance and the service also exists.

Should this be how monitor.abortRequested() works?
In a service should I be using a different abort requested mechanism?
I observed similar behavior and submitted a ticket to Kodi. My guess is it's a bug.

https://forum.kodi.tv/showthread.php?tid=317384

Sent from my SM-G935T
I found if I go back to my original way

Code:
if xbmc.abortRequested:
   <do service stuff>
   xbmc_monitor.waitForAbort(1)

then it works as intended.
(2017-07-31, 08:26)null_pointer Wrote: [ -> ]I found if I go back to my original way

Code:
if xbmc.abortRequested:
   <do service stuff>
   xbmc_monitor.waitForAbort(1)

then it works as intended.

This isn't a loop unless you left something out Smile
Code:
while not xbmc.abortRequested:
   <do service stuff>
   xbmc.sleep(1000)
(2017-08-01, 00:05)null_pointer Wrote: [ -> ]
Code:
while not xbmc.abortRequested:
   <do service stuff>
   xbmc.sleep(1000)
Yeah your bypassing the problem area...Smile
I believe it's a bug with waitforabort.

Sent from my SM-G935T
PR11852, and fixed in Kodi 18.

Hasn't yet been backported to Kodi 17.
(2017-08-01, 03:51)Milhouse Wrote: [ -> ]PR11852, and fixed in Kodi 18.

Hasn't yet been backported to Kodi 17.

Thanks for the heads up...
Is this going to be backported? It looks like the fix was added back in Mar, this might have even made the 17.3 build if it was backported back then.
PR12610.