How can I run an XBMC/Kodi video-plugin in python script?

6.3k Views Asked by At

I am trying to develop an XBMC/Kodi addon and my goal is run script and plugins from python script. There are buttons in addon.py when you pushed them, the addon that specified will run. I achieved this for picture and game add-on. Like this:

if control == self.button1:
  xbmc.executebuiltin("RunScript(script.game)")
if control == self.button2:
  xbmc.executebuiltin("RunScript(script.picture)")

I tried this way to call video plugin, but give me some error message. When I searched this problem, I found this:

"Do not try to run Plugins files from the scripts window as that will only give you a weird error message"

Is there an another way to call a video plugin from python script or can we a write a video-script instead of plugin?

2

There are 2 best solutions below

1
Gahan On BEST ANSWER

You should call video plugin as follow:

xbmc.executebuiltin("ActivateWindow(<window-id>,'plugin://<plugin-id>/<parameter-optional>',return)")
ex.
xbmc.executebuiltin("ActivateWindow(10025,'plugin://plugin.video.example/',return)")

from kodi 17 window ID for video plugin is 10025

2
Rachit kapadia On

You can also use RunPlugin and RunAddon which are the builtin Function of Kodi. (for detail refer this KODI List of builtin Functions)

Here is the example to run any plugin :

  1. To run plugin use : xbmc.executebuiltin('RunPlugin("plugin.video.something")')

  2. To run script use : xbmc.executebuiltin('RunAddon("script.something")')