home · contact · privacy
Change "video_about" namens into "yt_video" or variation thereof. master
authorChristian Heller <c.heller@plomlompom.de>
Sat, 23 Nov 2024 05:33:29 +0000 (06:33 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 23 Nov 2024 05:33:29 +0000 (06:33 +0100)
templates/results.tmpl
templates/video_about.tmpl [deleted file]
templates/videos.tmpl
templates/yt_video.tmpl [new file with mode: 0644]
ytplom/misc.py

index 124704a1a518da1219a4217014730b84f54e2966..db9d9a518e7e989468b0c6651568bcc88f732abf 100644 (file)
@@ -7,14 +7,14 @@
 {% for video in videos %}
 <tr>
 <td>
 {% for video in videos %}
 <tr>
 <td>
-<a href="/video_about/{{video.id_}}"><img src="/thumbnails/{{video.id_}}.jpg" /></a>
+<a href="/yt_video/{{video.id_}}"><img src="/thumbnails/{{video.id_}}.jpg" /></a>
 </td>
 <td>
 {{video.definition}}<br />
 {{video.duration}}
 </td>
 <td>
 </td>
 <td>
 {{video.definition}}<br />
 {{video.duration}}
 </td>
 <td>
-<b><a href="/video_about/{{video.id_}}">{{video.title}}</a></b> · {{video.description}}
+<b><a href="/yt_video/{{video.id_}}">{{video.title}}</a></b> · {{video.description}}
 </td>
 </tr>
 {% endfor %}
 </td>
 </tr>
 {% endfor %}
diff --git a/templates/video_about.tmpl b/templates/video_about.tmpl
deleted file mode 100644 (file)
index 358cced..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<html>
-<meta charset="UTF-8">
-<body>
-<p><a href="/playlist">playlist</a> · <a href="/videos">videos</a> · <a href="/queries">queries</a></p>
-<table>
-<tr><th>title:</th><td>{{video_data.title}}</td></tr>
-<tr><th>thumbnail:</th><td><img src="/thumbnails/{{video_data.id_}}.jpg" /></td></tr>
-<tr><th>description:</th><td>{{video_data.description}}</td></tr>
-<tr><th>duration:</th><td>{{video_data.duration}}</td></tr>
-<tr><th>definition:</th><td>{{video_data.definition}}</td></tr>
-<tr><th>YouTube ID:</th><td>{{video_data.id_}} (<a href="{{youtube_prefix}}{{video_data.id_}}">watch</a>)</td></tr>
-<tr><th>download:</th><td>{% if is_temp %}working on it{% else %}<a href="/dl/{{video_data.id_}}">{{ file_path if file_path else "please do" }}</a>{% endif %}</td></tr>
-<tr>
-<th>linked queries:</th>
-<td>
-<ul>
-{% for query in queries %}<li><a href="/query/{{query.id_}}">{{query.text}}</a>{% endfor %}
-</ul>
-</td>
-</tr>
-</table>
-</body>
-</html>
-
index daba8ed2953f75f484cc1ecf5407cec526396e07..3fb3648668cd58e0ffd8ef28eca91a64181a1a90 100644 (file)
@@ -5,7 +5,7 @@
 <p>downloaded videos:</p>
 <ul>
 {% for video_id, path in videos %}
 <p>downloaded videos:</p>
 <ul>
 {% for video_id, path in videos %}
-<li><a href="/video_about/{{video_id}}">{{ path }}</a>
+<li><a href="/yt_video/{{video_id}}">{{ path }}</a>
 {% endfor %}
 </ul>
 </body>
 {% endfor %}
 </ul>
 </body>
diff --git a/templates/yt_video.tmpl b/templates/yt_video.tmpl
new file mode 100644 (file)
index 0000000..358cced
--- /dev/null
@@ -0,0 +1,24 @@
+<html>
+<meta charset="UTF-8">
+<body>
+<p><a href="/playlist">playlist</a> · <a href="/videos">videos</a> · <a href="/queries">queries</a></p>
+<table>
+<tr><th>title:</th><td>{{video_data.title}}</td></tr>
+<tr><th>thumbnail:</th><td><img src="/thumbnails/{{video_data.id_}}.jpg" /></td></tr>
+<tr><th>description:</th><td>{{video_data.description}}</td></tr>
+<tr><th>duration:</th><td>{{video_data.duration}}</td></tr>
+<tr><th>definition:</th><td>{{video_data.definition}}</td></tr>
+<tr><th>YouTube ID:</th><td>{{video_data.id_}} (<a href="{{youtube_prefix}}{{video_data.id_}}">watch</a>)</td></tr>
+<tr><th>download:</th><td>{% if is_temp %}working on it{% else %}<a href="/dl/{{video_data.id_}}">{{ file_path if file_path else "please do" }}</a>{% endif %}</td></tr>
+<tr>
+<th>linked queries:</th>
+<td>
+<ul>
+{% for query in queries %}<li><a href="/query/{{query.id_}}">{{query.text}}</a>{% endfor %}
+</ul>
+</td>
+</tr>
+</table>
+</body>
+</html>
+
index 579c3ce754c26583e6c35365705ca9250855a51b..4d06781d4c01635f5cfe8ecf1bfb75a9b7aceaff 100644 (file)
@@ -56,7 +56,7 @@ PATH_TEMPLATES = PathStr(path_join(PATH_WORKDIR, 'templates'))
 NAME_TEMPLATE_QUERIES = PathStr('queries.tmpl')
 NAME_TEMPLATE_RESULTS = PathStr('results.tmpl')
 NAME_TEMPLATE_VIDEOS = PathStr('videos.tmpl')
 NAME_TEMPLATE_QUERIES = PathStr('queries.tmpl')
 NAME_TEMPLATE_RESULTS = PathStr('results.tmpl')
 NAME_TEMPLATE_VIDEOS = PathStr('videos.tmpl')
-NAME_TEMPLATE_VIDEO_ABOUT = PathStr('video_about.tmpl')
+NAME_TEMPLATE_YT_VIDEO = PathStr('yt_video.tmpl')
 NAME_TEMPLATE_PLAYLIST = PathStr('playlist.tmpl')
 PATH_TEMPLATE_QUERIES = PathStr(path_join(PATH_TEMPLATES,
                                           NAME_TEMPLATE_QUERIES))
 NAME_TEMPLATE_PLAYLIST = PathStr('playlist.tmpl')
 PATH_TEMPLATE_QUERIES = PathStr(path_join(PATH_TEMPLATES,
                                           NAME_TEMPLATE_QUERIES))
@@ -663,8 +663,8 @@ class TaskHandler(BaseHTTPRequestHandler):
                 self._send_or_download_video(YoutubeId(toks_url[2]))
             elif 'videos' == page_name:
                 self._send_videos_index()
                 self._send_or_download_video(YoutubeId(toks_url[2]))
             elif 'videos' == page_name:
                 self._send_videos_index()
-            elif 'video_about' == page_name:
-                self._send_video_about(YoutubeId(toks_url[2]))
+            elif 'yt_video' == page_name:
+                self._send_yt_video_data(YoutubeId(toks_url[2]))
             elif 'missing.json' == page_name:
                 self._send_missing_json()
             elif 'query' == page_name:
             elif 'missing.json' == page_name:
                 self._send_missing_json()
             elif 'query' == page_name:
@@ -713,7 +713,7 @@ class TaskHandler(BaseHTTPRequestHandler):
             self._send_http(content=video)
             return
         self.server.downloads.queue_download(video_id)
             self._send_http(content=video)
             return
         self.server.downloads.queue_download(video_id)
-        self._send_http(headers=[('Location', f'/video_about/{video_id}')],
+        self._send_http(headers=[('Location', f'/yt_video/{video_id}')],
                         code=302)
 
     def _send_query_page(self, query_id: QueryId) -> None:
                         code=302)
 
     def _send_query_page(self, query_id: QueryId) -> None:
@@ -735,7 +735,7 @@ class TaskHandler(BaseHTTPRequestHandler):
                 NAME_TEMPLATE_QUERIES, {'queries': queries_data,
                                         'quota_count': quota_count})
 
                 NAME_TEMPLATE_QUERIES, {'queries': queries_data,
                                         'quota_count': quota_count})
 
-    def _send_video_about(self, video_id: YoutubeId) -> None:
+    def _send_yt_video_data(self, video_id: YoutubeId) -> None:
         conn = DatabaseConnection()
         linked_queries = YoutubeQuery.get_all_for_video(conn, video_id)
         try:
         conn = DatabaseConnection()
         linked_queries = YoutubeQuery.get_all_for_video(conn, video_id)
         try:
@@ -744,7 +744,7 @@ class TaskHandler(BaseHTTPRequestHandler):
             video_data = YoutubeVideo(video_id)
         conn.commit_close()
         self._send_rendered_template(
             video_data = YoutubeVideo(video_id)
         conn.commit_close()
         self._send_rendered_template(
-                NAME_TEMPLATE_VIDEO_ABOUT,
+                NAME_TEMPLATE_YT_VIDEO,
                 {'video_data': video_data,
                  'is_temp': video_id in self.server.downloads.ids_unfinished,
                  'file_path': self.server.downloads.ids_to_paths.get(video_id,
                 {'video_data': video_data,
                  'is_temp': video_id in self.server.downloads.ids_unfinished,
                  'file_path': self.server.downloads.ids_to_paths.get(video_id,