2014-02-18, 23:10
First off. I'm a noob to python but not programming in general (VB.NET, vbscript, powershell, autoit). So please bear with me. Also please move this thread if it's posted in the incorrect location. since it really is not an addon.
I'm trying to use my raspberry pi (or any windows/linux python client) to return a list of movies and the thumbnail. What I'm looking for is a way to cycle through the found movies. I can't get past the first step of returning the data into a List or Dictionary(not sure which is better).
This is my current sample code for testing:
this returns:
To me this looks like a dictionary wrapped in a dictionary and list.
I have no idea how to reference that data in a variable (list or dictionary)
Also I would like it to download the thumbnail if possible.
Any help or suggestions if i'm going about this in the right or wrong direction.
Thanks!
I'm trying to use my raspberry pi (or any windows/linux python client) to return a list of movies and the thumbnail. What I'm looking for is a way to cycle through the found movies. I can't get past the first step of returning the data into a List or Dictionary(not sure which is better).
This is my current sample code for testing:
Code:
url = 'http://10.1.1.130:8080/jsonrpc?request={"jsonrpc":"2.0","method":"VideoLibrary.GetMovies","params":{"filter":{"field":"playcount","operator":"is","value":"0"},"limits":{"start":0,"end":75},"properties":["thumbnail","file"],"sort":{"order":"ascending","method":"label","ignorearticle":true}},"id":"libMovies"}'
import json, requests, urllib
r = requests.get(url)
r.status_code
print r
print r.status_code
print r.text
print r.encoding
this returns:
Code:
{"id":"libMovies","jsonrpc":"2.0","result":{"limits":{"end":3,"start":0,"total":3},"movies":[{"file":"/home/sysop/Videos/aliens.avi","label":"Aliens","movieid":1,"thumbnail":"image://http%3a%2f%2fimage.tmdb.org%2ft%2fp%2foriginal%2f4dw4JX6uqGPO5v5bJYusaGNSON2.jpg/"},{"file":"/home/sysop/Videos/cars.mp4","label":"Cars","movieid":2,"thumbnail":"image://http%3a%2f%2fimage.tmdb.org%2ft%2fp%2foriginal%2fwjn9AKZy98qCiixi9iWpuxiUTfh.jpg/"},{"file":"/home/sysop/Videos/planes.AVI","label":"Planes","movieid":3,"thumbnail":"image://http%3a%2f%2fimage.tmdb.org%2ft%2fp%2foriginal%2f8CkrElYZnYrIWEDGE5V2Xn4hl58.jpg/"}]}}
To me this looks like a dictionary wrapped in a dictionary and list.
I have no idea how to reference that data in a variable (list or dictionary)
Also I would like it to download the thumbnail if possible.
Any help or suggestions if i'm going about this in the right or wrong direction.
Thanks!