Question about sysarguments
#1
I have a question about System arguments, do I need to handle the arguments or they are handled from kodi ?

I get the following error when I am trying to run this example script:

import sys
import urllib
import urlparse
import xbmcgui
import xbmcplugin
import requests
import pyxbmct
from xml.dom import minidom

base_url = sys.argv[0]
addon_handle = int(sys.argv[1])
args = urlparse.parse_qs(sys.argv[2][1:])

xbmcplugin.setContent(addon_handle, 'movies')

def build_url(query):
return base_url + '?' + urllib.urlencode(query)

mode = args.get('mode', None)

if mode is None:
url = build_url({'mode': 'folder', 'foldername': 'Folder One'})
li = xbmcgui.ListItem('Folder One', iconImage='DefaultFolder.png')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
listitem=li, isFolder=True)

url = build_url({'mode': 'folder', 'foldername': 'Folder Two'})
li = xbmcgui.ListItem('Folder Two', iconImage='DefaultFolder.png')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
listitem=li, isFolder=True)

xbmcplugin.endOfDirectory(addon_handle)

elif mode[0] == 'folder':
foldername = args['foldername'][0]
url = 'http://localhost/some_video.mkv'
li = xbmcgui.ListItem(foldername + ' Video', iconImage='DefaultVideo.png')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
xbmcplugin.endOfDirectory(addon_handle)


Error Contents: list index out of range
Traceback (most recent call last):
File "C:\Users\Marian Pavel\AppData\Roaming\Kodi\addons\script.digistorageplayer\addon.py", line 15, in <module>
addon_handle = int(sys.argv[1])
IndexError: list index out of range

Full log file: http://xbmclogs.com/plupxk6nj
Reply
#2
let's start by fixing the basics:
Code:
10:03:53 T:1100    INFO: ADDON: cpluff: 'XML parsing error in C:\Program Files (x86)\Kodi\addons\script.digistorageplayer\addon.xml, line 2, column 101 (not well-formed (invalid token)).'
10:03:53 T:1100    INFO: ADDON: cpluff: 'Plug-in descriptor in C:\Program Files (x86)\Kodi\addons\script.digistorageplayer is invalid.'

this means there's a typo in your addon.xml file.


furthermore, don't mix / match scripts and plugins.

you're obviously writing a plugin, so use an addon id that reflects that, like plugin.video.digistorageplayer
also make sure you're using the xbmc.python.pluginsource extension point in your addon.xml file
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
#3
(2016-03-16, 11:57)ronie Wrote: let's start by fixing the basics:
Code:
10:03:53 T:1100    INFO: ADDON: cpluff: 'XML parsing error in C:\Program Files (x86)\Kodi\addons\script.digistorageplayer\addon.xml, line 2, column 101 (not well-formed (invalid token)).'
10:03:53 T:1100    INFO: ADDON: cpluff: 'Plug-in descriptor in C:\Program Files (x86)\Kodi\addons\script.digistorageplayer is invalid.'

this means there's a typo in your addon.xml file.


furthermore, don't mix / match scripts and plugins.

you're obviously writing a plugin, so use an addon id that reflects that, like plugin.video.digistorageplayer
also make sure you're using the xbmc.python.pluginsource extension point in your addon.xml file

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.digistorageplayer" name="***" version="1.0.0" provider-name="***">
<requires>
<import addon="script.module.pyxbmct" version="1.1.4"/>
<import addon="xbmc.python" version="2.14.0"/>
<import addon="script.module.requests" version="2.9.1"/>
</requires>
<extension point="xbmc.python.pluginsource" library="addon.py">
<provides>executable</provides>
</extension>
<extension point="xbmc.addon.metadata">
<platform>all</platform>
<summary lang="en">Digi Storage Player</summary>
<description lang="en">Digi Storage Player</description>
<license>GNU General Public License, v2</license>
<language></language>
<email>***</email>
</extension>
</addon>

This is how I ended up with the XML.
Reply
#4
And why do you need pyxbmct at all?
Reply
#5
Wanted to use to create the GUI
Reply
#6
Thank you for your help Smile I managed to make the script work however I get the following error when I am trying to change to a specific folder:

http://xbmclogs.com/phkyrifxw

Is there a way how can I solve this ?
Reply

Logout Mark Read Team Forum Stats Members Help
Question about sysarguments0