Skip to main content

用于与 Bose Soundtouch 设备通信的库和 cli

项目描述

用于Bose SoundTouch (R) API的 python 库和 cli 。

为了能够从命令行使用我的 Bose Soundtouch 10。

并且能够将其用作家庭助理的图书馆https://home-assistant.io/

并成为“我的第一个点子”包:-)

安装

要安装 boos python 库,只需:

pip install boos

嘘声需要 Python >= 3.4。

快速开始

连接到您的 Bose SoundTouch (R) 设备并激活预设 3

在 python 中工作:

from boos import Boos

booz = Boos("http://boos.fritz.box:8090")
booz.preset(3)
booz.vol()
booz.vol(30)

或者,如果您可以在 Linux 上运行 python 3 代码:

# 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 set 3
boos vol
boos vol 30
或者创建一个 virtualenv 并创建一些 bash 文件::

virtualenv -p python3 boos cd boos pip install boos

# 和一个 bash 文件,例如:

#!/bin/bash

来源 /home/richard/venv/boos/bin/activate /home/richard/dev/boos/boos/cli.py “$@”

打包

全部来自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

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

boos-0.5.3.tar.gz (5.8 kB 查看哈希)

已上传 source