View Single Post
Old 09-17-2011, 06:16 PM   #1
KariK
Member
KariK began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Jul 2011
Device: iPad
mi.timestamp set from imported book

Hi,
I am trying to add a bunch of books into calbre, but want the Date column in calibre to show the Last Modified Date of the existing book, so I can sort the books according to when I acquired them.

I have modified the import_book function to set the mi.timestamp field to:
mi.timestamp = datetime.fromtimestamp(os.path.getmtime(path))
This is in import_book (in database2.py) at:
for path in formats:
ext = os.path.splitext(path)[1][1:].lower()
mi.timestamp = datetime.fromtimestamp(os.path.getmtime(path))

By adding prints I can see that the timestamp is changed. I use the
calbredb add <directory where the existing books are>
command. I delete all books and the metadata file from the calibre directory before running the command, so there should be no old data.

But if I do:
calibredb list -f title,timestamp
command right after, I see that the timestamp date is still today's for all books. So something seems to overwrite my change, but I do not see what it could be?

If I understand this correctly, calibredb calls command_add, which calls do_add, which calls (in my case) import_book_directory_multiple, which calls import_book. I just can not see what could be overwriting mi.timestamp after the import_book call.
KariK is offline   Reply With Quote