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.
|