1
0
Fork 0
mirror of https://codeberg.org/Reuh/feather.git synced 2025-10-27 18:19:32 +00:00

feat: set mtime and atime for generated files

This commit is contained in:
Étienne Fildadut 2025-10-09 21:42:41 +02:00
parent 07e0e0be9f
commit 360117deb1
3 changed files with 12 additions and 4 deletions

View file

@ -1,11 +1,17 @@
# Feather: local file-based RSS reader # Feather: file-based RSS reader
## Usage ## Usage
### Reading a feed ### Reading a feed
Directories, opening an item, sorting/searching by date/title (a.k.a. using a file manager)
### Marking items as read ### Marking items as read
Delete
See read items in the trash can
### Updating with the server ### Updating with the server
Call `feather sync` to synchronize all local data with the server (read items, new items from the server, etc.). 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 - [ ] inotify might still be nice
- [x] Make HTML filename configurable - [x] Make HTML filename configurable
- [x] Make HTML template configurable - [x] Make HTML template configurable
- [ ] Nested categories - [ ] Nested categories: ttrss-python?
- [ ] Share the fun somewhere - [ ] Share the fun somewhere
- [x] Edge cases: mark as read during sync (if marked as read on server or not) - [x] Edge cases: mark as read during sync (if marked as read on server or not)
- [x] Proper filename escaping - [x] Proper filename escaping
- [x] Command to force regenerate all HTML files (incl. recompute datetimes & paths) - [x] Command to force regenerate all HTML files (incl. recompute datetimes & paths)
- [x] Handle item updates - [x] Handle item updates
- [ ] Actually think about the issues created by the duplicate warning - [ ] 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

View file

@ -49,7 +49,7 @@ template = '''
''' '''
# Filename template for generated HTML files. # Filename template for generated HTML files.
# Can be set through the environment variable HTML_FILENAME_TEMPLATE. # 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. # 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. # Can be set through the environment variable HTML_MAX_FILENAME_LENGTH.
max_filename_length = 250 max_filename_length = 250

View file

@ -235,6 +235,8 @@ def generate_html_for_item(config, item_json, regenerate=False):
else: else:
with html_path.open("w") as f: with html_path.open("w") as f:
f.write(config.item_template.render(item_json)) 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): def remove_html_for_item(config, item_json, ignore_deleted=False):
# Delete a HTML file for a JSON object # Delete a HTML file for a JSON object