2016-03-16, 10:33
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
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