From: Christian Heller <c.heller@plomlompom.de> Date: Sat, 23 Nov 2024 05:33:29 +0000 (+0100) Subject: Change "video_about" namens into "yt_video" or variation thereof. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/condition_titles?a=commitdiff_plain;h=4e25ace0cfcb49ed40cc921ae5030660b40ef975;p=ytplom Change "video_about" namens into "yt_video" or variation thereof. --- diff --git a/templates/results.tmpl b/templates/results.tmpl index 124704a..db9d9a5 100644 --- a/templates/results.tmpl +++ b/templates/results.tmpl @@ -7,14 +7,14 @@ {% 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> -<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 %} diff --git a/templates/video_about.tmpl b/templates/video_about.tmpl deleted file mode 100644 index 358cced..0000000 --- a/templates/video_about.tmpl +++ /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> - diff --git a/templates/videos.tmpl b/templates/videos.tmpl index daba8ed..3fb3648 100644 --- a/templates/videos.tmpl +++ b/templates/videos.tmpl @@ -5,7 +5,7 @@ <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> diff --git a/templates/yt_video.tmpl b/templates/yt_video.tmpl new file mode 100644 index 0000000..358cced --- /dev/null +++ b/templates/yt_video.tmpl @@ -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> + diff --git a/ytplom/misc.py b/ytplom/misc.py index 579c3ce..4d06781 100644 --- a/ytplom/misc.py +++ b/ytplom/misc.py @@ -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_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)) @@ -663,8 +663,8 @@ class TaskHandler(BaseHTTPRequestHandler): 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: @@ -713,7 +713,7 @@ class TaskHandler(BaseHTTPRequestHandler): 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: @@ -735,7 +735,7 @@ class TaskHandler(BaseHTTPRequestHandler): 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: @@ -744,7 +744,7 @@ class TaskHandler(BaseHTTPRequestHandler): 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,