Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 01-08-2026, 04:16 PM   #1
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
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.
JimmXinu is offline   Reply With Quote
Old 01-08-2026, 06:19 PM   #2
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
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:
BetterRed is offline   Reply With Quote
Old 01-08-2026, 06:31 PM   #3
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 7,237
Karma: 5007213
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Basically the same. Touch updates mtime. The directory and files are removed on restore currently.
JimmXinu is offline   Reply With Quote
Old 01-08-2026, 06:49 PM   #4
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 22,159
Karma: 30317706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by JimmXinu View Post
Basically the same. Touch updates mtime. The directory and files are removed on restore currently.
Aa-ha - didn't realise that format removes can't be restored individually.

BR
BetterRed is offline   Reply With Quote
Old 01-08-2026, 11:55 PM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,869
Karma: 29151636
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://github.com/kovidgoyal/calibr...8650f4bc24356d
kovidgoyal is offline   Reply With Quote
Old 01-09-2026, 10:42 AM   #6
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 7,237
Karma: 5007213
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Thanks!
JimmXinu is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 03:23 AM.


MobileRead.com is a privately owned, operated and funded community.