View Single Post
Old 10-21-2018, 08:48 PM   #2
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Your code is reading the publisher from the database. Then it is writing the publisher to the actual book file. The second time you run it, it does the same thing. Nothing in there has updated the database that calibre uses for the interface. You probably should be writing to the database with "db.get_metadata". That mirrors how you got the publisher. You then have to decide whether to embed the changes in the formats.

And the reason you are seeing it twice is that you are looping over the formats available for that book. The book must have two formats for this to happen. And "Original Publisher" changes from one loop to the next as you are not fetching it at the start of the loop.

It might be a good idea to state what you are trying to do. From this, I don't know if you are trying to update the metadata in the library, or put it in the actual file.
davidfor is offline   Reply With Quote