{% set widgetLength = playlist.widgets|length %}
{% set remaining = spotsFound - widgetLength %}
{% for widget in playlist.widgets %}
{{ loop.index }}
{% if widget.viewble %}
{% if widget.module.getModule().type == 'image' %}
{% set downloadUrl = urlFor("library.download", {id: widget.getPrimaryMediaId()}) %}
{% else %}
{% endif %}
{% endif %}
{% if widget.module.getModule().regionSpecific == 0 and widget.editable %}
{% if not widget.viewble %}
{% elseif not widget.editable %}
{% else %}
{% endif %}
{% else %}
{% endif %}
{% if widget.deletable == 1 and currentUser.routeViewable("/playlist") and widget.module.getModule().regionSpecific == 0 %}
{% endif %}
{% endfor %}
{% if remaining > 0 %}
{% for i in 0..remaining - 1 %}
{{ loop.index + widgetLength }}
{% if loop.first %}
{% else %}
{% endif %}
{% endfor %}
{% endif %}