IIRC and depending on how the book is added, the source file is opened in db.cache.add_format or in gui2.add.DBAdder.add_formats. The function db.backend.add_format takes an open file stream and writes it to the calibre library using info passed in other parameters.
There are lots of ways of adding books, such as copy from a device, by drag-and-drop, by copy-to-library, recursive walks, auto-add, etc. There is also a difference between adding a book and adding a format to an existing book.
|