Calibre does not keep track of the last time you opened a book, but your filesystem does. Or at least, it kinda does. Thankfully you can use Calibre template functions and custom columns to make use of this information.
- Go to
Preferences -> Advanced -> Template Functions - Select the
Functionfield at the bottom left of the window - Type
last_accessedand give it some documentation if you like - Set
Argument countto-1because the required arguments have everything we need - In the
Program codebox on the right, paste this code (you may have to fiddle with the indentation):
def evaluate(self, formatter, kwargs, mi, locals):
from os import stat
from time import ctime
book_paths = [f['path'] for f in mi.get('format_metadata', {}).values()]
atimes = map(lambda f: stat(f).st_atime, book_paths)
most_recent = max(atimes)
return ctime(most_recent)- Click
Createat the bottom center (orReplaceif you messed up the first time!) - Click
Applyat the bottom right
- Go to
Preferences -> Interface -> Add your own columns - Click
Add custom columnat the bottom - Click
Formatsin theQuick Createline at the top of the dialog window - In
Lookup nameenterlast_accessed - In
Column headingenterLast Accessed(orLast read, etc.) - Give it a description if you like
- In the
Templatefield, enter{:'last_accessed()'} - Set the
Sort/search column bydropdown toDate - Click
OKto close the custom column dialog - Click
Applyto finish adding the column
The changes you made will take effect when Calibre restarts. If it did not prompt you already, just close and reopen it. You can now sort books by the last date you watched them!
would you mind showing me how to sort the books by the last-accessed oreder in the calibre 6.7.1.
it dowsnt work foe me.