From: Christian Heller <c.heller@plomlompom.de> Date: Thu, 13 Feb 2025 07:08:58 +0000 (+0100) Subject: In file view, add play button. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/%7B%7Bdb.prefix%7D%7D/%7B%7Bprefix%7D%7D/index.html?a=commitdiff_plain;p=ytplom In file view, add play button. --- diff --git a/src/templates/file_data.tmpl b/src/templates/file_data.tmpl index 8564dff..c3f4dc8 100644 --- a/src/templates/file_data.tmpl +++ b/src/templates/file_data.tmpl @@ -23,7 +23,7 @@ input[type=submit].dangerous { color: red; } <tr> <th>present:</th> -<td>{% if file.present %}<a href="/{{page_names.download}}/{{file.yt_id}}">yes</a>{% else %}no{% endif %}</td> +<td>{% if file.present %}<a href="/{{page_names.download}}/{{file.yt_id}}">yes</a> <input type="submit" name="play" value="play" />{% else %}no{% endif %}</td> </tr> <tr> diff --git a/src/ytplom/http.py b/src/ytplom/http.py index c91100c..443355c 100644 --- a/src/ytplom/http.py +++ b/src/ytplom/http.py @@ -118,6 +118,12 @@ class _TaskHandler(PlomHttpHandler): def _receive_file_data(self) -> None: digest = Hash.from_b64(self.path_toks[2]) + if self.postvars.has_key('play'): + with DbConn() as conn: + file = VideoFile.get_one(conn, digest) + self.server.player.inject_and_play(file) + self._redirect(Path(self.postvars.first_for('redir_target'))) + return if not (self.server.config.allow_file_edit # also if whitelist, ⦠and self.server.config.whitelist_tags_display.empty): self.send_http(b'no way', code=403) # ⦠cuz input form under â¦