merge station.liq and config.liq

This commit is contained in:
bkfox
2015-12-12 15:52:30 +01:00
parent 8911f90875
commit 202992521e
4 changed files with 101 additions and 52 deletions

View File

@ -1,26 +0,0 @@
{# Utilities #}
def interactive_source (id, s, ) = \
s = store_metadata(id=id, size=1, s) \
add_skip_command(s) \
s \
end \
\
def stream (id, file) = \
s = playlist(id = '#{id}_playlist', mode = "random", file) \
interactive_source(id, s) \
end \
\
{# Config #}
set("server.socket", true) \
set("server.socket.path", "{{ settings.AIRCOX_LIQUIDSOAP_SOCKET }}") \
{% for key, value in settings.AIRCOX_LIQUIDSOAP_SET.items %}
set("{{ key|safe }}", {{ value|safe }}) \
{% endfor %}
\
\
{% for controller in monitor.controllers.values %}
{% include 'aircox_liquidsoap/station.liq' %} \
{{ controller.id }} = make_station_{{ controller.id }}() \
output.alsa({{ controller.id }}) \
{% endfor %}

View File

@ -0,0 +1,76 @@
{# Utilities #}
def interactive_source (id, s) = \
s = store_metadata(id=id, size=1, s) \
add_skip_command(s) \
s \
end \
\
def stream (id, file) = \
s = playlist(id = '#{id}_playlist', mode = "random", \
reload_mode='watch', file) \
interactive_source(id, s) \
end \
\
{# Config #}
set("server.socket", true) \
set("server.socket.path", "{{ settings.AIRCOX_LIQUIDSOAP_SOCKET }}") \
{% for key, value in settings.AIRCOX_LIQUIDSOAP_SET.items %}
set("{{ key|safe }}", {{ value|safe }}) \
{% endfor %}
\
\
{% for controller in monitor.controllers.values %}
{# station #}
{{ controller.id }} = interactive_source ( \
"{{ controller.id }}", \
fallback(track_sensitive = false, [ \
{# dealer #}
{% with source=controller.dealer %}
{% if source %}
at(interactive.bool('{{ source.id }}_on', false), \
interactive_source('{{ source.id }}', playlist.once( \
reload_mode='watch', \
"{{ source.path }}", \
)) \
), \
{% endif %}
{% endwith %}
{# streams #}
interactive_source("{{ controller.id }}_streams", rotate([ \
{% for source in controller.streams.values %}
{% with info=source.stream_info %}
{% if info.delay %}
delay({{ info.delay }}., stream("{{ source.id }}", "{{ source.path }}")), \
{% elif info.begin and info.end %}
at({ {{info.begin}}-{{info.end}} }, stream("{{ source.id }}", "{{ source.path }}")), \
{% endif %}
{% endwith %}
{% endfor %}
{% for source in controller.streams.values %}
{% if not source.stream_info %}
stream("{{ source.id }}", "{{ source.path }}"), \
{% endif %}
{% endfor %}
])), \
{# fallback #}
{% if controller.station.fallback %}
single("{{ controller.station.fallback }}"), \
{% else %}
blank(), \
{% endif %}
]) \
) \
\
{% for output in controller.outputs %}
output.{{ output.get_type_display }}( \
{{ controller.id }}
{% if controller.settings %}, \
{{ controller.settings }}
{% endif %}
) \
{% endfor %}
{% endfor %}