From 360117deb10dd66b3a18ed548155ddc1b330d82d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Reuh=20Fildadut?= Date: Thu, 9 Oct 2025 21:42:41 +0200 Subject: [PATCH] feat: set mtime and atime for generated files --- README.md | 12 +++++++++--- config.default.toml | 2 +- main.py | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4db6727..33ad3ab 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,17 @@ -# Feather: local file-based RSS reader +# Feather: file-based RSS reader ## Usage ### Reading a feed +Directories, opening an item, sorting/searching by date/title (a.k.a. using a file manager) + ### Marking items as read +Delete + +See read items in the trash can + ### Updating with the server Call `feather sync` to synchronize all local data with the server (read items, new items from the server, etc.). @@ -45,11 +51,11 @@ After changing the configuration, you can call `feather regenerate` to regenerat - [ ] inotify might still be nice - [x] Make HTML filename configurable - [x] Make HTML template configurable -- [ ] Nested categories +- [ ] Nested categories: ttrss-python? - [ ] Share the fun somewhere - [x] Edge cases: mark as read during sync (if marked as read on server or not) - [x] Proper filename escaping - [x] Command to force regenerate all HTML files (incl. recompute datetimes & paths) - [x] Handle item updates - [ ] Actually think about the issues created by the duplicate warning -- [ ] Set generated files creation/modification date instead of putting date in filename +- [x] Set generated files creation/modification date instead of putting date in filename diff --git a/config.default.toml b/config.default.toml index 07d22c4..68667f8 100644 --- a/config.default.toml +++ b/config.default.toml @@ -49,7 +49,7 @@ template = ''' ''' # Filename template for generated HTML files. # Can be set through the environment variable HTML_FILENAME_TEMPLATE. -filename_template = "{{ published_formatted }}\t[{{ origin_title }}]\t{{ title }}.html" +filename_template = "[{{ origin_title }}]\t{{ title }} ({{ published_formatted }}).html" # Maximum allowed filename length (in bytes assuming UTF-8 encoding) before truncating. Depending on your filesystem filename's limits it may be possible to increase the value, ask Wikipedia for details. # Can be set through the environment variable HTML_MAX_FILENAME_LENGTH. max_filename_length = 250 diff --git a/main.py b/main.py index 82c6fc6..8340604 100755 --- a/main.py +++ b/main.py @@ -235,6 +235,8 @@ def generate_html_for_item(config, item_json, regenerate=False): else: with html_path.open("w") as f: f.write(config.item_template.render(item_json)) + # set accessed date to update time, modified to publication time + os.utime(html_path, (max(item_json["updated"], item_json["updated"]), item_json["published"])) def remove_html_for_item(config, item_json, ignore_deleted=False): # Delete a HTML file for a JSON object