-{% macro _link_if(cond, target) %}{% if cond %}<a href="/{{target}}">{% endif %}{{target}}{% if cond %}</a>{% endif %}{% endmacro %}
+{% macro _link_if(cond, target, display_name = false ) %}{% if cond %}<a href="/{{target}}">{% endif %}{% if display_name %}{{display_name}}{% else %}{{target}}{% endif %}{% if cond %}</a>{% endif %}{% endmacro %}
-{% macro nav_head(selected="") %}
+{% macro nav_head(page_names, selected="") %}
<p>
{{ _link_if("playlist" != selected, page_names.playlist) }}
·
{{ _link_if("files" != selected, page_names.files) }}
·
-{{ _link_if("yt_queries" != selected, page_names.yt_queries) }}
+{{ _link_if("yt_queries" != selected, page_names.yt_queries, "queries") }}
</p>
<hr />
{% endmacro %}
{% block body %}
-{{ macros.nav_head("playlist") }}
+{{ macros.nav_head(page_names, "playlist") }}
<table>
<tr><td id="status" colspan=2>
{% if running %}{% if pause %}PAUSED{% else %}PLAYING{% endif %}{% else %}STOPPED{% endif %}:<br />
{% block body %}
-{{ macros.nav_head("yt_queries") }}
+{{ macros.nav_head(page_names, "yt_queries") }}
<p>quota: {{quota_count}}/100000</p>
<form action="/{{page_names.yt_queries}}" method="POST" />
<input name="query" />
{% block body %}
-{{ macros.nav_head() }}
+{{ macros.nav_head(page_names) }}
<p>query: {{query}}</p>
<table>
{% for video in videos %}
<tr>
<td>
-<a href="/{{page_names.yt_result}}/{{video.id_}}"><img src="/{page_names.thumbnails}/{{video.id_}}.jpg" /></a>
+<a href="/{{page_names.yt_result}}/{{video.id_}}"><img src="/{{page_names.thumbnails}}/{{video.id_}}.jpg" /></a>
</td>
<td>
{{video.definition}}<br />
{% block body %}
-{{ macros.nav_head() }}
+{{ macros.nav_head(page_names) }}
<table>
<tr><th>path:</th><td>{{file.rel_path}}</td></tr>
<tr><th>YouTube ID:</th><td><a href="/{{page_names.yt_result}}/{{file.yt_id}}">{{file.yt_id}}</a></tr>
{% block body %}
-{{ macros.nav_head("files") }}
+{{ macros.nav_head(page_names, "files") }}
<p>downloaded videos:</p>
<ul>
{% for video_id, path in videos %}
{% block body %}
-{{ macros.nav_head() }}
+{{ macros.nav_head(page_names) }}
<table>
<tr><th>title:</th><td>{{video_data.title}}</td></tr>
<tr><th>thumbnail:</th><td><img src="/{{page_names.thumbnails}}/{{video_data.id_}}.jpg" /></td></tr>
# page names
PAGE_NAMES: PageNames = {
- 'download': PathStr('dll'),
- 'file': PathStr('fille'),
- 'files': PathStr('filles'),
+ 'download': PathStr('dl'),
+ 'file': PathStr('file'),
+ 'files': PathStr('files'),
'last_update': PathStr('last_playlist_update.json'),
- 'missing': PathStr('missing.jsoner'),
- 'playlist': PathStr('playlisttt'),
- 'thumbnails': PathStr('thumbnailz'),
- 'yt_result': PathStr('ytt_video'),
- 'yt_query': PathStr('ytt_query'),
- 'yt_queries': PathStr('ytt_queries')
+ 'missing': PathStr('missing.json'),
+ 'playlist': PathStr('playlist'),
+ 'thumbnails': PathStr('thumbnails'),
+ 'yt_result': PathStr('yt_video'),
+ 'yt_query': PathStr('yt_query'),
+ 'yt_queries': PathStr('yt_queries')
}
# yt_dlp config