I'd like your opinion on the most efficient way to handle a json response in py. All I'm trying to do is use JSON to get the XBMC movie IDs for a series of IMDB numbers, but in the absence of any JSON filters I need to dump the whole thing to a string (quite quick) then turn it into a massive searchable tuple (very slow). JSON is my alternative to using sql to connect to the db - I quite like not being dependent on db type or location.
This cannot be the smartest way to go about things - ideas?
Code:
import re, simplejson, xbmc, jsonrpclib
jsonurl='{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies","params": {"properties" : ["tag","imdbnumber"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"}'
jsonresponse=simplejson.loads(xbmc.executeJSONRPC(jsonurl))
xbmcdbtuple = re.findall(r'imdbnumber\': u\'(.+?)\', u\'tag\': \[(.+?)\]\', u\'movieid\': (.+?), u\'label\': \'(.+?)\'', data)
This cannot be the smartest way to go about things - ideas?