gracefully set the stream on loop when starting all the things

parent 588b241f
Pipeline #34491 passed with stage
in 2 minutes and 30 seconds
#!/usr/bin/env python3
# Make sure voctocore has been set to loop
# Credits to voctomix example scripts
import socket
import sys
host = 'localhost'
port = 9999
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
try:
sock.connect((host, port))
sock.settimeout(2)
except ConnectionRefusedError:
sys.exit('Voctocore is not running. Exiting')
fd = sock.makefile('rw', buffering=1)
fd.write('set_stream_blank loop\n')
try:
for line in fd:
words = line.rstrip('\n').split(' ')
signal = words[0]
args = words[1:]
if (signal == 'stream_status' and args[0] == 'blank'
and args[1] == 'loop'):
print('Voctomix set to loop')
sys.exit()
except socket.timeout as err:
sys.exit('There was a problem while asking voctocore to display '
'the loop. Please retry or put Voctomix on loop manually')
......@@ -8,6 +8,12 @@
- stop
- start
- name: Script to verify that command to put voctocore into loop has worked
copy:
src: files/voctocore-set-loop
dest: /usr/local/bin/voctocore-set-loop
mode: 0755
- name: Script to show streams
template:
src: templates/videoteam-show-streams.j2
......
......@@ -22,3 +22,8 @@ systemctl --user list-unit-files --state=enabled \
echo systemctl --user {{ item }} $service
systemctl --user {{ item }} $service || true
done
{% if item == 'start' %}
voctocore-set-loop
{% endif %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment