Kodi Addon Development: sys.argv empty list

930 views Asked by At

I just started to look in to the development of a Kodi plugin.
However I'm stuck at finding the process handle of my plugin.

The documentation provides this as an explanation of how you should get this 'process id'

... Kodi passes some arguments to us via sys.argv. This is important, since it's what will let us tailor the output on the add-on based on user input. Remember, much like a web site, each folder (or page) in an Kodi add-on is the result of a separate invocation of our script. The arguments available to us are:

  • 0 The base URL of your add-on, e.g. 'plugin://plugin.video.myaddon/'
  • 1 The process handle for this add-on, as a numeric string
  • 2 The query string passed to your add-on, e.g. '?foo=bar&baz=quux'

However when I try to get this value it returns an array with only 1 element

if __name__ == '__main__':
    baseUrl = sys.argv[0]
    processHandle = sys.argv[1]
    qs = sys.argv[2]

debugger showing the result of the sys.argv which shows that there is nothing in the array

I'm running Kodi v15 on my local machine (Ubuntu 16.04) and I have a remote debugger attached. Any ideas to why this array does not contain the desired arguments?

Thanks in advance!

1

There are 1 answers

0
timr On BEST ANSWER

My bad I had an error in my addon.xml.
I had

<extension point="xbmc.python.script"
           library="addon.py">
    <provides>video</provides>
</extension>

instead of

<extension point="xbmc.python.pluginsource"
           library="addon.py">
    <provides>video</provides>
</extension>