与Bose Soundtouch设备通信的库和CLI
boos的Python项目详细描述
用于Bose SoundTouch (R) API的python库和cli。
能够从命令行使用我的bose soundtouch 10。
并能将其用作家庭助理的库https://home-assistant.io/
成为“我的第一个PIP”套餐:—)
安装
要安装boos python库,只需:
pip install boos
boos需要python>;=3.4。
快速启动
连接到Bose SoundTouch(R)设备并启动预设3
在python中工作:
fromboosimportBoosbooz=Boos("http://boos.fritz.box:8090")booz.preset(3)booz.vol()booz.vol(30)
或者如果您可以在Linux上运行Python3代码:
# create a symbolic link to the cli.py # and (for now) be sure in cli.py you have the right url defined sudo ln -s ./boos/cli.py /usr/local/bin/boos # run boos boos set3 boos vol boos vol 30
- 或者创建一个virtualenv并创建一些bash文件:
绿脓杆菌 CD Boos pip安装boos
#还有一个bash文件,比如:
#啊!/垃圾箱/垃圾桶
source/home/richard/venv/boos/bin/激活 /home/richard/dev/boos/boos/cli.py“$@”
链接
- 另一种选择是看看https://github.com/chassing/badtouch
- Bose Soundtouch(R)API http://products.bose.com/api-developer/index.html
- 家庭助理https://home-assistant.io/
包装
全部来自https://python-packaging-user-guide.readthedocs.org/en/latest/distributing/#source-distributions
# source dist python3 setup.py sdist # creating a universal wheel? python3 setup.py bdist_wheel # now setup a local webserver to test cd dist python -m SimpleHTTPServer 9000# and in another terminal # create a python 3 virtual environment venv (all as usual) virtualenv -p python3 venv cd venv source bin/activate # now in python python3 >>> from boos import Boos >>> booz= Boos("http://boos.fritz.box:8090") >>> booz.preset(3)# setting to preset 3 >>> print(booz.now_playing())# should show current playing song/source # https://packaging.python.org/en/latest/distributing/#uploading-your-project-to-pypi # # create a .pypirc file in home dir [distutils] index-servers= pypi testpypi [testpypi]repository= https://testpypi.python.org/pypi username= <your user name goes here> password= <your password goes here> [pypi]repository= https://pypi.python.org/pypi username= <your user name goes here> password= <your password goes here> # # to upload it to testpypi (https://wiki.python.org/moin/TestPyPI) # first register the project python setup.py register -r https://testpypi.python.org/pypi # preferred (given you have username and testpypi as key in .pypirc: twine upload -r testpypi dist/* # or python setup.py sdist upload -r https://testpypi.python.org/pypi # after upload install via # search pip search --index https://testpypi.python.org/pypi boos # install pip install -i https://testpypi.python.org/pypi boos # or to pypi # preferred: # first register project python setup.py register # preferred (given you have username and testpypi as key in .pypirc: twine upload -r pypi dist/* # or python setup.py sdist upload -r https://pypi.python.org/pypi # and install pip install boos