Kodi Community Forum
Kodi v18 xbmc.runplugin no longer passes arguments - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Kodi v18 xbmc.runplugin no longer passes arguments (/showthread.php?tid=328392)



Kodi v18 xbmc.runplugin no longer passes arguments - zachmorris - 2018-02-11

Hello,

I'm testing my addon with alpha builds of v18 and noticed that context menus no longer work.  I've isolated it down to running the following command:
python:
XBMC.RunPlugin(plugin://plugin.program.iarl/path_to_route?tag_value=xyz)

In Kodi v17 tag_value = xyz would get passed to my plugin as expected.  In Kodi v18 tag_value seems to be dropped and the arguments are empty when the path_to_route is executed.  Is this a bug, or is there a new way to pass values like this?

Thank you!


RE: Kodi v18 xbmc.runplugin no longer passes arguments - zachmorris - 2018-02-13

Edit.  I figured out a workaround.  I'm convinced that XBMC.RunPlugin acts differently between v17 and v18.  I think it removes the argument as part of a plugin://path, so if you execute:
XBMC.RunPlugin(plugin://plugin.program.iarl/path_to_route?tag_value=xyz)
it will remove the tag_value now and pass it as a sys.argv instead.

The workaround I've got is to look at sys.argv as well.  If the tag is empty, then use sys.argv[2] instead.


RE: Kodi v18 xbmc.runplugin no longer passes arguments - Roman_V_M - 2018-02-14

(2018-02-13, 08:38)zachmorris Wrote: Edit.  I figured out a workaround.  I'm convinced that XBMC.RunPlugin acts differently between v17 and v18.  I think it removes the argument as part of a plugin://path, so if you execute:
XBMC.RunPlugin(plugin://plugin.program.iarl/path_to_route?tag_value=xyz)
it will remove the tag_value now and pass it as a sys.argv instead.

I have no idea what XBMC.RunPlugin is. If you are using some custom library, you should clarify this explicitly. Kodi has always been passing plugin call query string via sys.argv[2]. Anything else is either a bug or unusual behavior and should not be relied upon.


RE: Kodi v18 xbmc.runplugin no longer passes arguments - Eldorado - 2018-02-14

(2018-02-14, 10:03)Roman_V_M Wrote:
(2018-02-13, 08:38)zachmorris Wrote: Edit.  I figured out a workaround.  I'm convinced that XBMC.RunPlugin acts differently between v17 and v18.  I think it removes the argument as part of a plugin://path, so if you execute:
XBMC.RunPlugin(plugin://plugin.program.iarl/path_to_route?tag_value=xyz)
it will remove the tag_value now and pass it as a sys.argv instead.

I have no idea what XBMC.RunPlugin is. If you are using some custom library, you should clarify this explicitly. Kodi has always been passing plugin call query string via sys.argv[2]. Anything else is either a bug or unusual behavior and should not be relied upon. 
 Kodi wiki - https://kodi.wiki/view/List_of_built-in_functions


RE: Kodi v18 xbmc.runplugin no longer passes arguments - zachmorris - 2018-02-14

(2018-02-14, 10:03)Roman_V_M Wrote:
(2018-02-13, 08:38)zachmorris Wrote: Edit.  I figured out a workaround.  I'm convinced that XBMC.RunPlugin acts differently between v17 and v18.  I think it removes the argument as part of a plugin://path, so if you execute:
XBMC.RunPlugin(plugin://plugin.program.iarl/path_to_route?tag_value=xyz)
it will remove the tag_value now and pass it as a sys.argv instead.

I have no idea what XBMC.RunPlugin is. If you are using some custom library, you should clarify this explicitly. Kodi has always been passing plugin call query string via sys.argv[2]. Anything else is either a bug or unusual behavior and should not be relied upon. 
 RunPlugin is a Kodi built in function.  As you said, it's possible it just worked incorrectly before and now the bug was fixed.  For completeness I've just posted my solution here as I'd guess other people would run into the same issue (this bug is in xbmcswift2 which is no longer supported).


RE: Kodi v18 xbmc.runplugin no longer passes arguments - Roman_V_M - 2018-02-14

(2018-02-14, 17:08)Eldorado Wrote:  Kodi wiki - List_of_built-in_functions (wiki)

It's just RunPlugin, without XBMC. part, at least when it's called via xbmc.executebuiltin().


RE: Kodi v18 xbmc.runplugin no longer passes arguments - zachmorris - 2018-02-15

(2018-02-14, 18:19)Roman_V_M Wrote:
(2018-02-14, 17:08)Eldorado Wrote:  Kodi wiki - List_of_built-in_functions (wiki)

It's just RunPlugin, without XBMC. part, at least when it's called via xbmc.executebuiltin().   
 Thanks Roman.  I was just quoting the code from xbmcswift2 and had originally followed the context menu example in the documentation.  I understand its not supported anymore.  Nevertheless, running the same code on v17 and v18 gives different results.  I'm still not entirely sure why, but if it's no longer broke I won't try to fix it.


RE: Kodi v18 xbmc.runplugin no longer passes arguments - ronie - 2018-02-15

fwiw, the 'xbmc' prefix for built-in commands has been deprecated years ago.