Figure out where kodi is when plugin is run
#1
Hi all,
I was wondering if there is a way to figure out in which window kodi is when a plugin is called? To give a little background. I want to see if I can make a context aware onscreen keyboard which selects for instance an auto complete provider based on where you are. So that in YouTube it takes YouTube while in your local lib auto completion is based on your lib. I have played around with info lables and they help me to figure out if a plugin is running with Container.FolderPath. unfortunately this seems to be null anywhere in home or settings so I can't figure out if someone is using it in home to search the lib or if he wants to do a setting. Maybe someone has an idea how to differentiate between home and settings maybe even more specific which settings are called so that a specific auto complete for let's say folders on your disk could be loaded.

Thanks
Benni
P.s. I also played with System.CurrentWindow which seems to be null all the time. Is that not working?
Reply
#2
a plugin is always called in the windows corresponding to the provided media type. i assume you mean service/script;

Code:
import xbmcgui
print('current window id: %i' %(xbmcgui.getCurrentWindowId()))
Reply
#3
Hi,
thanks for the fast reply.
I think i can get the info i need for the context from windowid combined with some infolabels. So that should work out. Thanks for that.
Are those window ids consistent across skins/kodi versions? I tried it with a view skins and it seems to be, just want to be sure it's not just a best practice thing.
Regarding the script/plugin thing i was kind of starting of the existing autocompletion addon which is a program plugin so that's why i thought of doing it similar.
I would have another question does the python api have anything to list installed scripts. I would like to make the whole thing modular so that i can identify the context extract some kind of keyword (let's say the plugin name or id or a special setting) and then look up if such a script is installed (got to come up with some naming schema) if no try to fetch it and use it. And if it failes default back to google or something like this. This would allow to easily extend the functionality to whatever plugin someone wants supported.

Thanks
Benni
Reply
#4
yes, window id's don't change.

you can use the json-rpc interface (http://kodi.wiki/view/JSON-RPC_API/v8) to fetch a list of installed addons:

python:
addons = xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Addons.GetAddons", "id":1}')
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#5
Cool thanks a lot. The support here is awesome thanks to you two for the fast and helpful replies.
Regards Benni
Reply

Logout Mark Read Team Forum Stats Members Help
Figure out where kodi is when plugin is run0