2020-03-21 11:31:27 +00:00
|
|
|
assert node.has_bundle('systemd')
|
|
|
|
|
|
|
|
streams = {
|
|
|
|
's1': {
|
|
|
|
'url': 'http://live.ber.c3voc.de:7999/s1',
|
|
|
|
'port': 15001,
|
|
|
|
},
|
|
|
|
's2': {
|
|
|
|
'url': 'http://live.ber.c3voc.de:7999/s2',
|
|
|
|
'port': 15002,
|
|
|
|
},
|
|
|
|
's3': {
|
|
|
|
'url': 'http://live.ber.c3voc.de:7999/s3',
|
|
|
|
'port': 15003,
|
|
|
|
},
|
|
|
|
's4': {
|
|
|
|
'url': 'http://live.ber.c3voc.de:7999/s4',
|
|
|
|
'port': 15004,
|
|
|
|
},
|
|
|
|
's5': {
|
|
|
|
'url': 'http://live.ber.c3voc.de:7999/s5',
|
|
|
|
'port': 15005,
|
|
|
|
},
|
|
|
|
's6': {
|
|
|
|
'url': 'http://live.ber.c3voc.de:7999/s6',
|
|
|
|
'port': 15006,
|
|
|
|
},
|
2020-04-11 09:29:04 +00:00
|
|
|
's23': {
|
|
|
|
'url': 'http://live.ber.c3voc.de:7999/s23',
|
|
|
|
'port': 15023,
|
|
|
|
},
|
|
|
|
's89': {
|
|
|
|
'url': 'http://live.ber.c3voc.de:7999/s89',
|
|
|
|
'port': 15089,
|
|
|
|
},
|
2020-03-21 11:31:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
files = {}
|
|
|
|
svc_systemd = {}
|
|
|
|
|
|
|
|
for stream_id, config in streams.items():
|
|
|
|
config['id'] = stream_id
|
|
|
|
|
|
|
|
files['/opt/voc-loudness-monitor/loudness_{}.sh'.format(stream_id)] = {
|
|
|
|
'source': 'loudness.sh',
|
|
|
|
'content_type': 'mako',
|
|
|
|
'context': config,
|
|
|
|
'mode': '0755',
|
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:loudness_{}:restart'.format(stream_id),
|
|
|
|
},
|
2020-03-21 11:42:33 +00:00
|
|
|
'needs': {
|
|
|
|
'pkg_apt:ffmpeg',
|
|
|
|
},
|
2020-03-21 11:31:27 +00:00
|
|
|
}
|
|
|
|
files['/etc/systemd/system/loudness_{}.service'.format(stream_id)] = {
|
|
|
|
'source': 'loudness.service',
|
|
|
|
'content_type': 'mako',
|
|
|
|
'context': config,
|
|
|
|
'needs': {
|
|
|
|
'file:/opt/voc-loudness-monitor/loudness_{}.sh'.format(stream_id),
|
|
|
|
},
|
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
'svc_systemd:loudness_{}:restart'.format(stream_id),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
svc_systemd['loudness_{}'.format(stream_id)] = {
|
|
|
|
'needs': {
|
|
|
|
'file:/etc/systemd/system/loudness_{}.service'.format(stream_id),
|
|
|
|
},
|
2020-03-27 11:50:50 +00:00
|
|
|
# These units are designed to fail if the assigned stream fails. No need
|
|
|
|
# to restart them on every bw run.
|
|
|
|
# Downside of this: services must be started once they are applied.
|
|
|
|
'running': None,
|
2020-03-21 11:31:27 +00:00
|
|
|
}
|