Determine when add-on is opened and closed
#1
Hi, 

I'm wanting to trigger a script when a particular add-on is opened and another when it is closed.

Is it possible to determine what add-on/plugin is currently active and when it no longer becomes so?

I've tried in a simple service that tries to obtain some information using Window InfoLabels and the xbmcgui module eg:

wid=xbmcgui.getCurrentWindowId()
wid2=xbmc.getInfoLabel('Window.Property(xmlfile)')

but the resulting values are not unique to the Add-on I'm interested in.

My basic idea is to have a service going on in the background that is checking whether an add-on has been opened and when it has been closed.

Any suggestions appreciated.

thanks
Reply
#2
(2017-11-29, 11:21)nzpm Wrote: Hi, 

I'm wanting to trigger a script when a particular add-on is opened and another when it is closed.

Is it possible to determine what add-on/plugin is currently active and when it no longer becomes so?

I've tried in a simple service that tries to obtain some information using Window InfoLabels and the xbmcgui module eg:

wid=xbmcgui.getCurrentWindowId()
wid2=xbmc.getInfoLabel('Window.Property(xmlfile)')

but the resulting values are not unique to the Add-on I'm interested in.

My basic idea is to have a service going on in the background that is checking whether an add-on has been opened and when it has been closed.

Any suggestions appreciated.

thanks
 I used following:
Quote:class Navigation():
    def __init__(self):
        pass

    # Check if a user has navigated to a Plugin
    def checkPlugins(self):
        navPath = xbmc.getInfoLabel("Container.FolderPath")[:9]

        if navPath == 'plugin://':
            pluginName = xbmc.getInfoLabel("Container.FolderName")
            return pluginName
        else:
            return ''

navPosition = Navigation()
navPosition.checkPlugins()

to check the addon.
Reply
#3
(2017-11-29, 11:35)DaLanik Wrote:
(2017-11-29, 11:21)nzpm Wrote: Hi, 

I'm wanting to trigger a script when a particular add-on is opened and another when it is closed.

Is it possible to determine what add-on/plugin is currently active and when it no longer becomes so?

I've tried in a simple service that tries to obtain some information using Window InfoLabels and the xbmcgui module eg:

wid=xbmcgui.getCurrentWindowId()
wid2=xbmc.getInfoLabel('Window.Property(xmlfile)')

but the resulting values are not unique to the Add-on I'm interested in.

My basic idea is to have a service going on in the background that is checking whether an add-on has been opened and when it has been closed.

Any suggestions appreciated.

thanks
 I used following:
Quote:class Navigation():
    def __init__(self):
        pass

    # Check if a user has navigated to a Plugin
    def checkPlugins(self):
        navPath = xbmc.getInfoLabel("Container.FolderPath")[:9]

        if navPath == 'plugin://':
            pluginName = xbmc.getInfoLabel("Container.FolderName")
            return pluginName
        else:
            return ''

navPosition = Navigation()
navPosition.checkPlugins()

to check the addon. 
 Perfect - worked a treat

thanks
Reply

Logout Mark Read Team Forum Stats Members Help
Determine when add-on is opened and closed0