{% macro shared_style() %} {% endmacro %} {% macro hidden_redirect_back(fragment="") %} {% endmacro %} {% macro no_input_post_form(uri, text, fragment="") -%}
{{ hidden_redirect_back(fragment=fragment) }}
{%- endmacro %} {% macro post_form(uri, key, val, text, fragment="") %}
{{ hidden_redirect_back(fragment=fragment) }}
{% endmacro %} {% macro as_play_link(element, symbol='▶️') -%} {# TODO do not hardcode certain extractors here #} {% if element.extractor_name in ["ytdl", "youtube"] %} {%- set opts = { "video_uri": element.uri, "start": element.progress, } -%} {{ symbol | safe }} {% endif %} {%- endmacro -%} {% macro _navigation() %} {% set links = { "🏠 Home"|safe: "/", "Latest Media": "/media", "Short Media": "/media/short", "Long Media": "/media/long", "Unsorted": "/media/unsorted", "Collections": "/collection", "All Collections": "/collection/all", "📌 Collections"|safe: "/collection/pinned", "Collections To Watch": "/collection/to_watch", "Statistics": "/stats", "Tags": "/tag", "Add Media": "/media/extract", "Add Collection": "/collection/extract", } %} {%- endmacro %} {% macro body_header() %} {{ _navigation() }} {%- endmacro %} {% macro media_element_buttons(element, show_fragment=True) %} {% set api_uri = "/api/media/" + element.id|string %} {% set fragment = ("media_element_" + element.id|string) if show_fragment else None %} {{ as_play_link(element) }} {% if element.watched %} {{ post_form(api_uri, "watched", "false", "Unmark as Watched", fragment) }} {% elif element.ignored %} {{ post_form(api_uri, "ignored", "false", "Unmark as Ignored", fragment) }} {% else %} {{ post_form(api_uri, "watched", "true", "Watched", fragment) }} {{ post_form(api_uri, "ignored", "true", "Ignore", fragment) }} {% endif %} {% endmacro %} {% macro link_position_marker(link, prefix=false) -%} {{- prefix and (link.season != 0 or link.episode != 0) | tenary(", ", "") -}} {%- if link.season != 0 -%} Season {{ link.season }} {{- (link.episode != 0) | tenary(", ", "") -}} {%- endif -%} {%- if link.episode != 0 -%} Episode {{ link.episode }} {%- endif -%} {%- endmacro %} {% macro media_entry_content(element, show_fragment=True) %} {{ media_element_buttons(element, show_fragment=show_fragment) }} {{ element.release_date.strftime("%d.%m.%Y") }} {{ element.length | timedelta }} {{ element.title }} {%- endmacro %} {% macro link_entry_content(link, show_fragment=True) %} {{ media_entry_content(link.element, show_fragment=show_fragment) -}} {{- link_position_marker(link, prefix=true) -}} {%- endmacro %} {% macro collection_entry_content(collection) %} {{ collection.title }} {%- endmacro %} {% macro media_entry(element, show_fragment=True) %}
  • {{ media_entry_content(element, show_fragment=show_fragment) }}
  • {%- endmacro %} {% macro link_entry(link, show_fragment=True) %}
  • {{ link_entry_content(link, show_fragment=show_fragment) }}
  • {%- endmacro %} {% macro media_table(media_list) %} {% for media in media_list %} {% endfor %}
    Date ⏲️ Title
    {{- media.release_date.strftime("%d.%m.%Y") -}} {{- media.left_length | timedelta -}} {{- media_element_buttons(media) -}} {{ media.title }}
    {%- endmacro %} {% macro link_differ_table(link_list) %} {% for link in link_list %} {% endfor %}
    Date ⏲️ Title From Collection
    {{- link.element.release_date.strftime("%d.%m.%Y") -}} {{- link.element.left_length | timedelta -}} {{- media_element_buttons(link.element) -}} {{ link.element.title }} {{ link.collection.id }} {{- link_position_marker(link, prefix=true) -}}
    {%- endmacro %}