savantaudio client
Initial 1.0 Release
Savantaudio-Client 패키지를 통해 사용자는이 Gihub 리포지토리의 내용을 다운로드하여 클라이언트 라이브러리가 포함되어있어 SSA-3220/SSA-3220D와 같은 Savant 오디오 스위치를 제어합니다.
PIP를 사용하여 설치 및 업데이트 :
pip3 install savantaudio-client또는이 저장소를 사용하여 복제 할 수 있습니다.
git clone https://github.com/akropp/savantaudio-client.git클라이언트는 Asyncio를 기반으로하므로 모든 통화는 이벤트 루프의 맥락에서 이루어져야합니다. 스위치 장치에 연결하고 모든 입력/출력을 가져 오는 기본 예는 다음과 같습니다.
import logging
import asyncio
import savantaudio . client
logging . basicConfig ( handlers = [ logging . StreamHandler ()], encoding = 'utf-8' , level = logging . INFO )
savantaudio . client . _LOGGER . setLevel ( logging . DEBUG )
switch = savantaudio . client . Switch ( host = '192.168.1.216' , port = 8085 )
loop = asyncio . new_event_loop ()
asyncio . set_event_loop ( loop )
loop . run_until_complete ( switch . refresh ())
print ( str ( switch ))
loop . run_until_complete ( switch . link ( 11 , 8 ))
loop . run_until_complete ( switch . output ( 11 ). set_volume ( - 20 ))
print ( str ( switch . output ( 11 )))
loop . run_until_complete ( switch . unlink ( 11 ))
print ( str ( switch . output ( 11 )))