From bf2e5956baff1037846bb28d90d926dffc5f1ae2 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Tue, 6 Mar 2018 14:28:04 +0100 Subject: [PATCH] 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 --- dev.sh | 2 +- main.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dev.sh b/dev.sh index 9046a34..5fe3abc 100755 --- a/dev.sh +++ b/dev.sh @@ -4,4 +4,4 @@ if ! which entr > /dev/null; then exit 1 fi -find . -name "*.py" | entr -r ./main.py +find . -name "*.py" | entr -r ./main.py --no-volume diff --git a/main.py b/main.py index 4fe2102..3b8d9ef 100755 --- a/main.py +++ b/main.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 -import os +import os, sys from remi import start +from threading import Timer from grzegorz_clients import api, remi_ui @@ -26,7 +27,15 @@ def main(config): ) 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"): shutil.copy("default_config.py", "config.py") import config + main(config)