|
|
#1 |
|
Plugin Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,237
Karma: 5007213
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
|
Recently deleted format timestamps don't update
I admit this is a little obscure, but it is something I've bumped into more than once.
Short version Calibre uses directory mtime for recently deleted formats. That's currently not updated when the same format of the same book is deleted again. This affects the deleted formats list order and will expire deleted formats sooner than it should. Long winded explanation As an FFF user, I end up deleting epub format from books a lot. Every time a story I'm following updates, and again when I 'mark it read'. In both cases, FFF deletes the epub format, sending it to 'recently deleted' kept in .caltrash. This is by design so you can take advantage of the restore feature. .caltrash has a dir under 'f' for each book which has recently deleted formats, and when a format is deleted again, it overwrites the prior recently deleted format file in that dir. No problems there. The issue I have is that Calibre uses the mtime of the directory, not the format file(s) when listing recently deleted formats. So the epub format I just deleted doesn't show up at the top of the list if I also deleted it 6 days ago. Because the directory mtime only changes when a file inside is added/deleted/renamed; overwriting an existing file inside doesn't count. And I just noticed that expire_old_trash() also uses the directory mtime to decide what to remove. Which means a format I just now deleted could be purged from trash for being too old if I also deleted it 7 days ago. A simple fix? A straightforward fix would be to force update of the directory mtime. Removing the metadata.json in the .caltrash dir before writing it works for me. Using the mtime of metadata.json instead of the dir would touch slightly more code. If it were that simple, I'd just submit a PR; but: Multiple deleted formats are grouped by book .caltrash uses the same directory for all recently deleted formats for a book, regardless of whether they were deleted at the same time or not. So my simple fix would also update the timestamp for all deleted formats for that book. And currently Calibre only offers the option of restoring all the saved recently deleted formats for each book. Ideally, I'd prefer if the recently deleted formats list offered each format of each book separately. But that would add complexity and raise more UI questions like ordering formats by age only or by book then age. I, personally, would consider something like my simple fix an improvement even so. |
|
|
|
|
|
#2 |
|
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 22,159
Karma: 30317706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
How about Touch the .caltrash/f/nnnn directory if a format is added or rewritten - but not if a format is deleted (restored).
added: apologies if that's what your 'simple fix' is the same in different words. BR Last edited by BetterRed; 01-08-2026 at 06:24 PM. Reason: added: |
|
|
|
|
|
#4 | |
|
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 22,159
Karma: 30317706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
BR |
|
|
|
|
|
|
#5 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,869
Karma: 29151636
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
|
|
|
|
|
#6 |
|
Plugin Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,237
Karma: 5007213
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
|
Thanks!
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A bunch of ebooks are in .caltrash, but I don't see them restore recently deleted | OregaNooo | Calibre | 3 | 04-09-2024 06:53 PM |
| How to recover recently deleted books | pinky62 | Library Management | 2 | 10-09-2021 04:01 PM |
| Unix timestamps when adding books | kensmosis | Library Management | 11 | 01-15-2016 05:27 PM |
| Troubleshooting Deleted titles then reloaded with Calibre but don't appear on Kindle? | rsngfrce | Amazon Kindle | 14 | 01-03-2015 11:17 PM |
| Firmware Update Did anyone get a Kindle DX Firmware update recently? | purl4peace | Amazon Kindle | 2 | 08-09-2009 05:42 PM |