Thanks for your answer. That gets me the path to the book in the Calibre database, but that's not what I'm looking for.
But what I need is the path to the book where it was prior to import.
Say I have a file "A" and import it into Calibre. It runs through a FileTypePlugin which reads the file "A", from that file it creates a new file "B", and returns a path to that new file "B" via that plugin's run() method.
Calibre then copies the file "B" to somewhere else, lets call it "B2".
Then that file "B2" is stored into the DB, and the book ID and the path to "B2" is handed into the plugin's postadd method. But I don't want B2, I want A. I would like to attach the original file "A", before it's modified by my FileTypePlugin, to be attached to the book "B(2)".
That means inside the postadd method, where I only know the book ID and "B2", I'd like to figure out what "A" is - so I can call "db.add_extra_files(book_id, A)" But the command you posted will also just return "B2" which I already know from the input parameters of the function anyways.
Inside "run" I only know "A" and "B". Inside "postadd" I only know "B2" (same file but different path as "B") and "book_id". I see no way to "link these together", but I need to know "book_id" and "A" at the same time to add that file to the book record.
Last edited by Leseratte_10; 05-06-2023 at 04:30 PM.
|