document template + add blocks
This commit is contained in:
parent
fe87e0be99
commit
df65d310f5
|
@ -1,76 +1,126 @@
|
||||||
{# Context: #}
|
{% comment %}
|
||||||
{# - controller: controller used to generate the current file #}
|
Base configuration file to configure a station on liquidsoap.
|
||||||
{# - settings: global settings #}
|
|
||||||
def interactive_source (id, s) = \
|
A Station is composed of multiple streams, that includes:
|
||||||
s = store_metadata(id=id, size=1, s) \
|
- controller.dealer: used to play scheduled programs;
|
||||||
add_skip_command(s) \
|
- controller.streams: streams configured to play random sounds;
|
||||||
s \
|
|
||||||
end \
|
# Interactive elements:
|
||||||
\
|
An interactive element is accessible to the people, in order to:
|
||||||
def stream (id, file) = \
|
- get metadata
|
||||||
#s = playlist(id = '#{id}_playlist', mode = "random", \
|
- skip the current sound
|
||||||
# file) \
|
- enable/disable it, only for the dealer
|
||||||
|
|
||||||
|
- {controller.id}: the station itself
|
||||||
|
- {controller.id}_streams: all the streams of a controller
|
||||||
|
- {source.id}: for each stream of a controller + dealer
|
||||||
|
|
||||||
|
|
||||||
|
# Element of the context
|
||||||
|
We use theses elements from the template's context:
|
||||||
|
- controller: controller describing the station itself
|
||||||
|
- settings: global settings
|
||||||
|
|
||||||
|
# Overwrite the template
|
||||||
|
It is possible to overwrite the template, there are blocks at different
|
||||||
|
position in order to do it. Keep in mind that you might want to avoid to
|
||||||
|
put station specific configuration in the template itself.
|
||||||
|
{% endcomment %}
|
||||||
|
|
||||||
|
|
||||||
|
{% comment %}
|
||||||
|
An interactive source is a source that:
|
||||||
|
- is skippable through the given id on external interfaces
|
||||||
|
- store metadata
|
||||||
|
{% endcomment %}
|
||||||
|
def interactive_source (id, s) =
|
||||||
|
s = store_metadata(id=id, size=1, s)
|
||||||
|
add_skip_command(s)
|
||||||
|
s
|
||||||
|
end
|
||||||
|
|
||||||
|
{% comment %}
|
||||||
|
a stream is a source that:
|
||||||
|
- is a playlist on random mode (playlist object accessible at {id}_playlist
|
||||||
|
- is interactive
|
||||||
|
{% endcomment %}
|
||||||
|
def stream (id, file) =
|
||||||
|
#s = playlist(id = '#{id}_playlist', mode = "random",
|
||||||
|
# file)
|
||||||
s = playlist(id = '#{id}_playlist', mode = "random", file)
|
s = playlist(id = '#{id}_playlist', mode = "random", file)
|
||||||
interactive_source(id, s) \
|
interactive_source(id, s)
|
||||||
end \
|
end
|
||||||
|
|
||||||
|
{% block extra_funcs %}
|
||||||
|
{% endblock %}
|
||||||
\
|
\
|
||||||
{# Config #}
|
{# config #}
|
||||||
set("server.socket", true) \
|
set("server.socket", true)
|
||||||
set("server.socket.path", "{{ controller.socket_path }}") \
|
set("server.socket.path", "{{ controller.socket_path }}")
|
||||||
{% for key, value in settings.AIRCOX_LIQUIDSOAP_SET.items %}
|
{% for key, value in settings.AIRCOX_LIQUIDSOAP_SET.items %}
|
||||||
set("{{ key|safe }}", {{ value|safe }}) \
|
set("{{ key|safe }}", {{ value|safe }})
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
\
|
|
||||||
|
{% block extra_config %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{# station #}
|
{# station #}
|
||||||
{{ controller.id }} = interactive_source ( \
|
{{ controller.id }} = interactive_source (
|
||||||
"{{ controller.id }}", \
|
"{{ controller.id }}",
|
||||||
fallback(track_sensitive = false, [ \
|
fallback(track_sensitive = false, [
|
||||||
{# dealer #}
|
{# dealer #}
|
||||||
{% with source=controller.dealer %}
|
{% with source=controller.dealer %}
|
||||||
{% if source %}
|
{% if source %}
|
||||||
at(interactive.bool('{{ source.id }}_on', false), \
|
at(interactive.bool('{{ source.id }}_on', false),
|
||||||
interactive_source('{{ source.id }}', playlist.once( \
|
interactive_source('{{ source.id }}', playlist.once(
|
||||||
reload_mode='watch', \
|
reload_mode='watch',
|
||||||
"{{ source.path }}", \
|
"{{ source.path }}",
|
||||||
)) \
|
))
|
||||||
), \
|
),
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
||||||
{# streams #}
|
{# streams #}
|
||||||
interactive_source("{{ controller.id }}_streams", rotate([ \
|
interactive_source("{{ controller.id }}_streams", rotate([
|
||||||
{% for source in controller.streams.values %}
|
{% for source in controller.streams.values %}
|
||||||
{% with info=source.stream_info %}
|
{% with info=source.stream_info %}
|
||||||
{% if info.delay %}
|
{% if info.delay %}
|
||||||
delay({{ info.delay }}., stream("{{ source.id }}", "{{ source.path }}")), \
|
delay({{ info.delay }}., stream("{{ source.id }}", "{{ source.path }}")),
|
||||||
{% elif info.begin and info.end %}
|
{% elif info.begin and info.end %}
|
||||||
at({ {{info.begin}}-{{info.end}} }, stream("{{ source.id }}", "{{ source.path }}")), \
|
at({ {{info.begin}}-{{info.end}} }, stream("{{ source.id }}", "{{ source.path }}")),
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% for source in controller.streams.values %}
|
{% for source in controller.streams.values %}
|
||||||
{% if not source.stream_info %}
|
{% if not source.stream_info %}
|
||||||
stream("{{ source.id }}", "{{ source.path }}"), \
|
stream("{{ source.id }}", "{{ source.path }}"),
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
])), \
|
])),
|
||||||
|
|
||||||
{# fallback #}
|
{# fallback #}
|
||||||
{% if controller.station.fallback %}
|
{% if controller.station.fallback %}
|
||||||
single("{{ controller.station.fallback }}"), \
|
single("{{ controller.station.fallback }}"),
|
||||||
{% else %}
|
{% else %}
|
||||||
blank(id="scheize_blank", duration=0.1), \
|
blank(id="scheize_blank", duration=0.1),
|
||||||
{% endif %}
|
{% endif %}
|
||||||
]) \
|
])
|
||||||
) \
|
)
|
||||||
\
|
\
|
||||||
|
|
||||||
|
{% block outputs %}
|
||||||
{% for output in controller.outputs %}
|
{% for output in controller.outputs %}
|
||||||
output.{{ output.get_type_display }}( \
|
output.{{ output.get_type_display }}(
|
||||||
{{ controller.id }}
|
{{ controller.id }}
|
||||||
{% if controller.settings %}, \
|
{% if controller.settings %},
|
||||||
{{ controller.settings }}
|
{{ controller.settings }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
) \
|
)
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% block extra_output %}
|
||||||
|
{% endblock %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
4
notes.md
4
notes.md
|
@ -8,15 +8,15 @@
|
||||||
- translation
|
- translation
|
||||||
|
|
||||||
- programs:
|
- programs:
|
||||||
- schedule: potential issue with nth' week of month
|
|
||||||
- tests:
|
- tests:
|
||||||
- sound_monitor
|
- sound_monitor
|
||||||
|
|
||||||
- liquidsoap:
|
- liquidsoap:
|
||||||
- models to template
|
- models to template -> note
|
||||||
- tests:
|
- tests:
|
||||||
- monitor
|
- monitor
|
||||||
- check when a played sound has a temp blank
|
- check when a played sound has a temp blank
|
||||||
|
- config generation and sound diffusion
|
||||||
|
|
||||||
- cms:
|
- cms:
|
||||||
- empty content -> empty string
|
- empty content -> empty string
|
||||||
|
|
Loading…
Reference in New Issue
Block a user