forked from kunsi/dotfiles
.bin/pulseaudio-assert-volume: add some flushing to print()
This commit is contained in:
parent
d4400473a0
commit
507f24e7b4
1 changed files with 4 additions and 4 deletions
|
@ -14,7 +14,7 @@ signal(SIGTERM, handle_signal)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print('Startup')
|
print('Startup', flush=True)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
@ -31,12 +31,12 @@ try:
|
||||||
if line.startswith('volume:'):
|
if line.startswith('volume:'):
|
||||||
for speaker, absolute, percent in findall('([a-z-]+):\W+([0-9]+)\W+\/\W+([0-9]+)%', line):
|
for speaker, absolute, percent in findall('([a-z-]+):\W+([0-9]+)\W+\/\W+([0-9]+)%', line):
|
||||||
if int(percent) < 100:
|
if int(percent) < 100:
|
||||||
print(f' sink {sink_id} speaker {speaker} at {percent} % volume')
|
print(f' sink {sink_id} speaker {speaker} at {percent} % volume', flush=True)
|
||||||
needs_adjusting = True
|
needs_adjusting = True
|
||||||
|
|
||||||
if needs_adjusting:
|
if needs_adjusting:
|
||||||
check_output(['pactl', 'set-sink-input-volume', sink_id, '100%'])
|
check_output(['pactl', 'set-sink-input-volume', sink_id, '100%'])
|
||||||
print(f' adjusted sink {sink_id} to 100%')
|
print(f' adjusted sink {sink_id} to 100%', flush=True)
|
||||||
|
|
||||||
needs_adjusting = False
|
needs_adjusting = False
|
||||||
|
|
||||||
|
@ -45,4 +45,4 @@ try:
|
||||||
|
|
||||||
sleep(0.5)
|
sleep(0.5)
|
||||||
finally:
|
finally:
|
||||||
print('Shutdown')
|
print('Shutdown', flush=True)
|
||||||
|
|
Loading…
Reference in a new issue