Posts: 21
Joined: Dec 2011
Reputation:
0
I have the following line of code that returns a sting of all my movies an rating. I need to then create a loop that goes through the resulting movies can anyone help?
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"properties": ["title", "mpaa"]}, "id": 1}')
FOR {each movie} IN {json_query}:
commands
Thanks.
Posts: 21
Joined: Dec 2011
Reputation:
0
Thanks Martijn, That got me much farther but I seem to be having an issue with a movie title Here is my code and error message
self.__log('Using JSON for retrieving MOVIE info')
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"properties": ["file", "title", "year", "trailer", "streamdetails"], "sort": { "method": "label" } }, "id": 1}')
json_response = unicode(json_response, 'utf-8', errors='ignore')
jsonobject = simplejson.loads(json_response)
if jsonobject['result'].has_key('movies'):
for item in jsonobject['result']['movies']:
self.__log('Movie id=%s %s' %( item.get('title',''), item.get('file','') ) )
When it hits my Alien3 movie i get the error
08:10:49 T:2643700544 ERROR: Error Type: <type 'exceptions.UnicodeEncodeError'>
08:10:49 T:2643700544 ERROR: Error Contents: 'ascii' codec can't encode character u'\xb3' in position 38: ordinal not in range(128)
Any thoughts? Thanks again.
Posts: 21
Joined: Dec 2011
Reputation:
0
Thanks, I will give that a try and see.
Posts: 21
Joined: Dec 2011
Reputation:
0
That fixed the logging, Thanks for your help