liblo的异步友好Python绑定
aiolo的Python项目详细描述
艾奥洛
liblo的异步友好Python绑定,POSIX系统的开放声音控制(OSC)协议的实现。在
安装
安装liblo:
苹果操作系统:brew install liblo
Ubuntu:apt-get install liblo7 liblo-dev
然后:
pip install aiolo
示例
Python中许多漂亮的特性之一就是支持操作符重载。aiolo热情地支持这一点,为未来的OSC黑客提供直观的编程体验,比如Message
,Bundle
,Route
,和{
Simple echo server
^{pr2}$MultiCast
importasyncioimportrandomfromaioloimportMultiCast,MultiCastAddress,Route,Serverasyncdefmain():# Create endpoints for receiving datafoo=Route('/foo',str)ex=Route('/exit')# Create a multicast groupmulticast=MultiCast('224.0.1.1',port=15432)# Create a cluster of servers in the same multicast groupcluster=[]foriinrange(10):server=Server(multicast=multicast)# Have them all handle the same routeserver.route(foo)server.route(ex)server.start()cluster.append(server)address=MultiCastAddress(server=random.choice(cluster))# Send a single message from any one server to the entire cluster.# The message will be received by each server.address.send(foo,'hello cluster')# Notify subscriptions to exit in 1 secaddress.delay(1,ex)# Listen for incoming strings at /foo on any server in the clustersubs=foo.sub()|ex.sub()asyncforroute,datainsubs:print(f'{route} got data: {data}')ifroute==ex:awaitsubs.unsub()forserverincluster:server.stop()if__name__=='__main__':asyncio.get_event_loop().run_until_complete(main())
支持的平台
Travis CI测试采用以下配置:
- Ubuntu 18.04仿生海狸+liblo 0.29+[CPython3.6,CPython3.7,CPython3.8,PyPy7.3.0(3.6.9)]
- 苹果操作系统+liblo 0.29+[CPython3.6,CPython3.7,CPython3.8,PyPy7.3.0(3.6.9)]
贡献
欢迎拉取请求,请将遇到的任何问题归档。在
变更日志
4.1.1(2020-07-22)
- 通过传递zip_safe=False来防止egg安装错误
4.1.0
- 纠正一些
__hash__
问题。在
4.0.0
- 使用基于Python的OSC地址模式匹配而不是liblo,支持转义特殊字符
- 确保ThreadedServer.start()等待线程初始化
- 修复订阅服务器可能无法接收挂起数据的错误
- 修复错误在哪里loop.remove_读取器()未被调用AioServer.stop()
- 项目
标签: