home · contact · privacy
To files listing add last_update sort column, but with cutoff at app start.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 3 Oct 2025 09:48:52 +0000 (11:48 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 3 Oct 2025 09:48:52 +0000 (11:48 +0200)
src/templates/files.tmpl
src/ytplom/misc.py

index cf258a68564060fae5e2f65be2c904f6c11db858..6091cbdb47ba50e4b1bf50a4c763511bd363413e 100644 (file)
@@ -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: <span id="files_count">?</span>):
 <th>actions</th>
 <th>tags <button class="sorter" onclick="sort_by(this, 'n_tags'); ">count</button></th>
 <th><button class="sorter" onclick="sort_by(this, 'rel_path'); ">path</button></th>
+<th><button class="sorter" onclick="sort_by(this, '-last_update'); ">last update</button></th>
 </tr>
 </table>
 {% endblock %}
index 793d8021a1960a0931fb4088d95a16ef67948f4a..74c623913f5e6bbf3f9160d8c7bc05b551ab9b64 100644 (file)
@@ -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: