From aaa2e0bd6644e5b12408299b789f8c6b737807c9 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Wed, 27 Nov 2024 00:37:43 +0100
Subject: [PATCH] Fix breakages due to previous unfinished commit.

---
 src/templates/_macros.tmpl  |  6 +++---
 src/templates/playlist.tmpl |  2 +-
 src/templates/queries.tmpl  |  2 +-
 src/templates/results.tmpl  |  4 ++--
 src/templates/video.tmpl    |  2 +-
 src/templates/videos.tmpl   |  2 +-
 src/templates/yt_video.tmpl |  2 +-
 src/ytplom/misc.py          | 18 +++++++++---------
 8 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/templates/_macros.tmpl b/src/templates/_macros.tmpl
index e11bc86..aa6ed50 100644
--- a/src/templates/_macros.tmpl
+++ b/src/templates/_macros.tmpl
@@ -1,13 +1,13 @@
-{% 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 %}
diff --git a/src/templates/playlist.tmpl b/src/templates/playlist.tmpl
index 7625714..c1d084e 100644
--- a/src/templates/playlist.tmpl
+++ b/src/templates/playlist.tmpl
@@ -36,7 +36,7 @@ td.history { width: 50%; }
 
 
 {% 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 />
diff --git a/src/templates/queries.tmpl b/src/templates/queries.tmpl
index 8dae26d..9ef271d 100644
--- a/src/templates/queries.tmpl
+++ b/src/templates/queries.tmpl
@@ -2,7 +2,7 @@
 
 
 {% 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" />
diff --git a/src/templates/results.tmpl b/src/templates/results.tmpl
index 1998f7f..872d461 100644
--- a/src/templates/results.tmpl
+++ b/src/templates/results.tmpl
@@ -2,13 +2,13 @@
 
 
 {% 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 />
diff --git a/src/templates/video.tmpl b/src/templates/video.tmpl
index 7de9b06..7ea70f9 100644
--- a/src/templates/video.tmpl
+++ b/src/templates/video.tmpl
@@ -2,7 +2,7 @@
 
 
 {% 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>
diff --git a/src/templates/videos.tmpl b/src/templates/videos.tmpl
index c49cf18..69543c8 100644
--- a/src/templates/videos.tmpl
+++ b/src/templates/videos.tmpl
@@ -2,7 +2,7 @@
 
 
 {% block body %}
-{{ macros.nav_head("files") }}
+{{ macros.nav_head(page_names, "files") }}
 <p>downloaded videos:</p>
 <ul>
 {% for video_id, path in videos %}
diff --git a/src/templates/yt_video.tmpl b/src/templates/yt_video.tmpl
index 3247741..73ffbab 100644
--- a/src/templates/yt_video.tmpl
+++ b/src/templates/yt_video.tmpl
@@ -2,7 +2,7 @@
 
 
 {% 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>
diff --git a/src/ytplom/misc.py b/src/ytplom/misc.py
index 48f475b..097c8c0 100644
--- a/src/ytplom/misc.py
+++ b/src/ytplom/misc.py
@@ -69,16 +69,16 @@ NAME_TEMPLATE_PLAYLIST = PathStr('playlist.tmpl')
 
 # 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
-- 
2.30.2