Mercurial > code > home > repos > racc
comparison volume_osx.py @ 1:04c8a1b3976b
volume r/w on linux+osx
author | drewp@bigasterisk.com |
---|---|
date | Fri, 03 Mar 2023 21:24:53 -0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:05bdded21d38 | 1:04c8a1b3976b |
---|---|
1 from osascript import osascript | |
2 | |
3 | |
4 async def get_volume(): | |
5 out = osascript('output volume of (get volume settings)') | |
6 return int(out[1]) / 100 | |
7 | |
8 | |
9 async def set_volume(v: float): | |
10 i = round(v * 100) | |
11 osascript(f"set volume output volume {i}") |