From 528f33a4f275db434ec10bbf60b0526170c74507 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Fri, 3 Oct 2025 11:48:52 +0200 Subject: [PATCH] To files listing add last_update sort column, but with cutoff at app start. --- src/templates/files.tmpl | 2 ++ src/ytplom/misc.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/templates/files.tmpl b/src/templates/files.tmpl index cf258a6..6091cbd 100644 --- a/src/templates/files.tmpl +++ b/src/templates/files.tmpl @@ -71,6 +71,7 @@ function populate_list_item_row(tr, file) { add_player_btn_to(td_inject, 'add as play', `injectplay_${file.digest}`, !file.present) add_tag_links_to(add_child_to('td', tr), file.tags_showable); add_a_to(add_child_to('td', tr), file.rel_path, `${PATH_PREFIX_FILE}${file.digest}`); + add_child_to('td', tr, {textContent: file.last_update}); } window.addEventListener('load', update_filter_inputs); {% endblock %} @@ -101,6 +102,7 @@ known files (shown: ?): actions tags + {% endblock %} diff --git a/src/ytplom/misc.py b/src/ytplom/misc.py index 793d802..74c6239 100644 --- a/src/ytplom/misc.py +++ b/src/ytplom/misc.py @@ -359,6 +359,7 @@ class VideoFile(DbData): digest: Hash tags: TagSet # class attributes + last_update_cutoff: DatetimeStr tags_prefilter_needed: TagSet tags_prefilter_whitelist: TagSet tags_display_whitelist: TagSet @@ -384,6 +385,8 @@ class VideoFile(DbData): ffprobe(self.full_path)['format']['duration']))) self.last_update = last_update if last_update else _now_string() self._hash_on_last_update = hash(self) + if not hasattr(self.__class__, 'last_update_cutoff'): + self.__class__.last_update_cutoff = _now_string() def __hash__(self) -> int: return hash(tuple(getattr(self, k) for k in self._cols)) @@ -399,6 +402,9 @@ class VideoFile(DbData): 'rel_path': str(self.rel_path), 'size': f'{self.size:.2f}', 'tags_showable': self.tags_showable.as_str_list, + 'last_update': ( + '' if self.last_update < self.__class__.last_update_cutoff + else str(self.last_update)[:16].replace(' ', '·')), } def save(self, conn: DbConn) -> None: -- 2.30.2