Mercurial > code > home > repos > racc
diff collector/volume_osx.py @ 4:5ad799e534a5
move to subdir
author | drewp@bigasterisk.com |
---|---|
date | Mon, 13 Mar 2023 18:50:23 -0700 |
parents | volume_osx.py@04c8a1b3976b |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/collector/volume_osx.py Mon Mar 13 18:50:23 2023 -0700 @@ -0,0 +1,11 @@ +from osascript import osascript + + +async def get_volume(): + out = osascript('output volume of (get volume settings)') + return int(out[1]) / 100 + + +async def set_volume(v: float): + i = round(v * 100) + osascript(f"set volume output volume {i}")