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:
parent
073a7c6d29
commit
bf2e5956ba
2
dev.sh
2
dev.sh
|
@ -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
11
main.py
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue