Add optional --no-volume program argument

It will regularily set the volume to 0, neat when testing out the player.
This option was also added to dev.sh
This commit is contained in:
Peder Bergebakken Sundt 2018-03-06 14:28:04 +01:00
parent 073a7c6d29
commit bf2e5956ba
2 changed files with 11 additions and 2 deletions

2
dev.sh
View File

@ -4,4 +4,4 @@ if ! which entr > /dev/null; then
exit 1 exit 1
fi fi
find . -name "*.py" | entr -r ./main.py find . -name "*.py" | entr -r ./main.py --no-volume

11
main.py
View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import os, sys
from remi import start from remi import start
from threading import Timer
from grzegorz_clients import api, remi_ui from grzegorz_clients import api, remi_ui
@ -26,7 +27,15 @@ def main(config):
) )
if __name__ == "__main__": if __name__ == "__main__":
if "--no-volume" in sys.argv[1:]:
print("Keeping volume down")
def keep_volume_down():
api.set_volume(0)
Timer(5, keep_volume_down).start()
Timer(5, keep_volume_down).start()
if not os.path.exists("config.py"): if not os.path.exists("config.py"):
shutil.copy("default_config.py", "config.py") shutil.copy("default_config.py", "config.py")
import config import config
main(config) main(config)