From: Christian Heller Date: Thu, 26 Dec 2024 02:26:35 +0000 (+0100) Subject: To file view, add button to unlink locally. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7Bdb.prefix%7D%7D/condition_titles?a=commitdiff_plain;h=434ff6f867254fe24400e7c9e88674e23857bbc0;p=ytplom To file view, add button to unlink locally. --- diff --git a/src/templates/file_data.tmpl b/src/templates/file_data.tmpl index d4dcf8b..8564dff 100644 --- a/src/templates/file_data.tmpl +++ b/src/templates/file_data.tmpl @@ -3,8 +3,9 @@ {% block css %} td.top_field { width: 100%; } -td.flags { text-align: right; } td.tag_checkboxes { width: 1em; } +td.dangerous, div.dangerous { text-align: right; } +input[type=submit].dangerous { color: red; } {% endblock %} @@ -64,7 +65,7 @@ td.tag_checkboxes { width: 1em; } flags: - + {% for flag_name in flag_names %} {{ flag_name }}:
{% endfor %} @@ -73,7 +74,10 @@ td.tag_checkboxes { width: 1em; } {% if allow_edit %} - + +
+ +
{% endif %} {% endblock %} diff --git a/src/ytplom/http.py b/src/ytplom/http.py index 0014383..11b29c0 100644 --- a/src/ytplom/http.py +++ b/src/ytplom/http.py @@ -181,6 +181,8 @@ class _TaskHandler(BaseHTTPRequestHandler): return # … this display filter might have suppressed set tags with DbConn() as conn: file = VideoFile.get_one(conn, digest) + if 'unlink' in postvars.as_dict: + file.unlink_locally() file.set_flags({FILE_FLAGS[FlagName(name)] for name in postvars.all_for('flags')}) file.tags = TagSet.from_str_list(postvars.all_for('tags')) diff --git a/src/ytplom/misc.py b/src/ytplom/misc.py index ddaac97..7821b1f 100644 --- a/src/ytplom/misc.py +++ b/src/ytplom/misc.py @@ -482,7 +482,11 @@ class VideoFile(DbData): if self.is_flag_set(FlagName('delete')) and self.present: print(f'SYNC: {self.rel_path} set "delete", ' 'removing from filesystem.') - self.full_path.unlink() + self.unlink_locally() + + def unlink_locally(self) -> None: + """Remove actual file from local filesystem.""" + self.full_path.unlink() class QuotaLog(DbData):