View Single Post
Old 05-02-2020, 01:23 AM   #3
dxcore35
Member
dxcore35 began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Mar 2018
Device: Kindle Voyage
Below is function I have trouble with. This is one of the variation of command I tired, but which failed.

Code:
def _do_add_custom_text (self, book_ids):
		from calibre.utils.html2text import html2text
        # Queue all the books and kick off the job
		
        dbA = self.gui.current_db
        db = self.gui.current_db.new_api
        cust_col_name = "#summarize"

        for id in book_ids:
            miA = dbA.get_metadata (id, index_is_id=True, get_cover=False)
            
            summary_text_old = miA.get (cust_col_name)	
			text_to_write = "WRITING THIS TEXT"
			text_to_write = text_to_write.decode('utf-8')

			lis_aux_id.append (text_to_write)

        dbA.new_api.set_field(cust_col_name, {id:id_aux[id] for id in lis_aux_id})
        self.gui.iactions['Edit Metadata'].refresh_gui(book_ids, covers_changed=False)
dxcore35 is offline   Reply With Quote