I'm very new to Python and so am struggling with what is probably very simply to a seasoned Python programmer.
The problem below is that when the groupid argument is supplied with a value, it is evaluated to ['groupid'].
Can someone please explain how I concatenate the string so that it simply has the groupid value without the square brackets and singles quotes?
Many thanks,
import sys
import xbmcgui
import xbmcplugin
import urllib
import urlparse
import xbmc, xbmcaddon, xbmcvfs, simplejson, urllib2
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)
groupid = args.get('groupid', None)
if (groupid is None):
testurl = 'hxxp://webserver.com/json.php'
else:
testurl = 'hxxp://webserver.com/json.php?group=' + str(groupid)
req = urllib2.urlopen(testurl)
response = req.read()
req.close()