2012-02-21 09:47:40 +00:00
|
|
|
pandora_client - python client and libary to access a pan.do/ra instances
|
2010-11-16 20:31:33 +00:00
|
|
|
|
2012-02-21 09:47:40 +00:00
|
|
|
For more info on using pandora_client, check
|
|
|
|
http://wiki.0x2620.org/wiki/pandora_client
|
2010-11-16 20:31:33 +00:00
|
|
|
|
|
|
|
pandora client example:
|
|
|
|
import pandora_client
|
|
|
|
#example config.json
|
|
|
|
'''
|
|
|
|
{
|
|
|
|
"url": "http://localhost:8000/api/",
|
|
|
|
"username": "username",
|
|
|
|
"password": "password",
|
|
|
|
"cache": "~/.ox/client.sqlite",
|
2010-11-27 11:35:56 +00:00
|
|
|
"media-cache": "~/.ox/media",
|
2010-11-16 20:31:33 +00:00
|
|
|
"volumes": {
|
|
|
|
"volumename": "/media/2010/Movies"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'''
|
|
|
|
c = pandora_client.Client('config.json')
|
|
|
|
c.scan() #scans all volumes for files and updates cache db
|
|
|
|
c.sync() #syncs cached file info with site, and encodes and uploads requested media
|
|
|
|
c.clean() #cleanup transcodes created druing sync to save disk space
|
|
|
|
|
|
|
|
|
|
|
|
just using the API:
|
2010-12-04 14:14:54 +00:00
|
|
|
api = pandora_client.API("http://localhost:8000/api/")
|
|
|
|
r = api.find(
|
|
|
|
query={'conditions':[]},
|
|
|
|
keys=['title', 'year'],
|
|
|
|
range=[0, 100]
|
|
|
|
)
|
|
|
|
for i in r['data']['items']:
|
|
|
|
...
|
|
|
|
|
2012-02-21 09:47:40 +00:00
|
|
|
api documentation is available as python docstrings.
|
|
|
|
i.e. in ipython:
|
|
|
|
api.find?
|
|
|
|
(alternatively you can open the api url in a browser to read further documentation)
|