Detecting if a Python service is running?
#16
I see what you are saying.

If I add the script button to the home screen.

As far as I can tell, with a script on the home screen, you can't get to the Addon information screen to enable/disable it.
If you could, this would be the only case my script wouldn't work.
However, it's not a critical function and more a "user friendliness" that the function doesn't run when script gets "enabled"
Reply
#17
Gotcha, just something that popped to mind and thought I'd try to possibly save you a few bug reports lol

Edit: I think there is a jsonrpc call to enable or disable an add-on.
Reply
#18
Yes, there is.

I used the XBMC.runaddon method in my default.py at the start and wondered why my script was in an endless loop.
It's because, the runaddon method calls the default.py - not the service.py Smile
Therefore, had to use executescript with an os.path.join of cwd and service.py
Reply
#19
I meant that a user could theoretically enable your service and be on any window at the time.

Also os.cwd is not reliable in xbmc. Can't remember the method off the top of my head, but xbmcAddon has a reliable method for obtaining the addon's directory
Reply
#20
yes. I use that addon.getcwd method Smile was just "summarising"

If they enable it while on the home window, then the system start function will run which will just be a bit annoying to the user (no biggy).
But, to do this - they will need to edit a skin file or have a python script call the json to enable the addon. For my type of script - this is highly unlikely.

I actually also have an argument that can be passed to the service.py that overrides and disables the function from running (which I actually use in my default.py when starting the service (if not running)).
So, if the user wants to manually start/stop the service, they can use the argument.
Reply

Logout Mark Read Team Forum Stats Members Help
Detecting if a Python service is running?0