{% macro host_toggle() -%} {%- endmacro %} {# The Spotify resume buttons with the host toggle in the middle of them. #} {% macro control_row(target, accounts) -%} {% set split = (accounts | length + 1) // 2 %}
{% for account in accounts %} {% if loop.index0 == split %}{{ host_toggle() }}{% endif %} {% endfor %} {# Fewer accounts than the midpoint means the loop never reached it. #} {% if accounts | length <= split %}{{ host_toggle() }}{% endif %}
{%- endmacro %}

{% for room in rooms %}

{{ room.label }}

{{ control_row(room.key, spotify_accounts) }}
{% endfor %}

{{ host.label }}

offline