View Single Post
Old 12-25-2020, 04:32 PM   #19
chris33
Enthusiast
chris33 began at the beginning.
 
Posts: 35
Karma: 10
Join Date: Sep 2020
Device: ipad, kobo libra 2
Question Cover regeneration

I have been able to change the book file for an exiting record in the database with :
Code:
self.gui.current_db.new_api.add_format(id, book_extension, path, True)
Unfortunately this doesn't seem to update the cover, or I missed something.
I want to regenerate the cover after uploading the new file using default page 1
Also I read "Covers are always changed if a new cover is provided, but are never deleted" in Calibre source code.
So should I remove it first, with remove_cover and then rebuild it with generate_cover ?
And use something like:
Code:
        img = generate_cover(self.mi, prefs=prefs, as_qimage=True)
        img.setDevicePixelRatio(dpr)
        self.preview_label.setPixmap(QPixmap.fromImage(img))
But in that case I don't see how to select page 1.
Is it the way to go or is there a simpler way to achieve this ?
chris33 is offline   Reply With Quote