pandora_client/README.md

86 lines
2 KiB
Markdown
Raw Normal View History

2018-04-03 08:27:41 +00:00
# pandora_client - python client and libary to access a pan.do/ra instances
2010-11-16 20:31:33 +00:00
2019-12-21 18:05:04 +00:00
Documentation at: https://code.0x2620.org/0x2620/pandora_client/wiki
## Installation
### Linux
- install dependencies
2019-12-21 18:14:41 +00:00
sudo apt install python3 python3-pip ffmpeg
2019-12-21 18:05:04 +00:00
- install pandora_client
sudo pip3 install pandora_client
### macOS
- install brew (https://brew.sh/)
- install dependencies
2019-12-21 18:34:48 +00:00
brew install python3
2019-12-21 18:05:04 +00:00
brew install libvpx libvorbis
brew install ffmpeg --with-libvpx --with-libvorbis --with-libopus
- install pandora_client
pip3 install pandora_client
2010-11-16 20:31:33 +00:00
2018-04-03 08:27:41 +00:00
## pandora client example:
2010-11-16 20:31:33 +00:00
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
2018-04-03 08:27:41 +00:00
## just using the API:
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)
2018-04-03 08:27:41 +00:00
## Distributed encoding
pandora_client can distribute the encoding to multiple nodes
on a local network or multiple encodings on the same host.
to do this you need to install additional dependencies:
2018-04-03 08:27:41 +00:00
apt-get install python3-twisted python3-requests
now run one node in server mode:
2018-04-03 08:27:41 +00:00
pandora_client server
and start the other nodes with:
2018-04-03 08:27:41 +00:00
pandora_client client http://SERVER_IP:8789