View Single Post
Old 04-23-2019, 11:47 PM   #12
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
Quote:
Originally Posted by ceridwen View Post
You're right that if I save the file somewhere else and reimport it, it keeps the custom column data. I did some experimentation on this and it left me more confused than I was before. If I unzip the test epub that contains the custom column data and then copy select tags into the content.opf of another test from the content.opf of the known-to-work ebub and re-zip it, Calibre doesn't pick up the metadata in the custom column. Copying the entire content.opf doesn't work, either. Most confusingly, if I unzip the known-to-work epub, don't change anything, and then zip the same files into a new epub, that doesn't get the custom column metadata when I import it. I even checked the extra field of the original zipfile, which seems to be empty.

Does anyone know how this works?
I'm not sure when you are doing this. I think the problem is the timing of what you have doing and when calibre reads the metadata.

Calibre reads the metadata when the book is first added (assuming appropriate options are set). It will read the custom columns from the OPF in the epub if matching columns exist in the library. Otherwise, they will be ignore. You can also read metadata from the file inside calibre from the Edit Metadata screen. Select the format you want to extract the metadata from in the top right corner and press the appropriate button.

Calibre doesn't automatically update the book when you change the metadata in calibre. It will update the metadata.opf file in the directory with the book. The actual book gets updated when you send it outside the library (save-to-disk and send-to-device - these do not update the copy of the book in the library), edit the book, convert it, use Polish book or use the Embed metadata function. Basically, you have to do something to have the book updated.

If you replace the copy of a book in the library, calibre doesn't change the metadata either in it's database or the file. This includes dropping the new version on the details pain of the exiting book, or adding the book and having duplicates merged automatically. If you want to update the metadata from the new version of the book, you need to do this manually as above. I would expect the same if you use the command-line to replace the book.

And as @ilovejedd said, if there is an external OPF file when you are adding a new book, calibre will use it for the metadata over the metadata in the book. Changing that is slightly simpler than changing the book.
Quote:
In this case, it's mean to be two separate tags. I entered those tags into the Calibre GUI manually to create the files I've been using for testing. Do you mean it has to be entered "foo", "bar" in the Calibre GUI?
No, in the calibre GUI, you enter "foo, bar". That will be treated as two tags; "foo" and "bar". When calibre saves this to the OPF file, it will be saved as:

Code:
"#value#": ["foo", "bar"]
It is stored in the OPF file as a comma separated list of quoted strings. With what you had, I would expect calibre to display in GUI "foo; bar". The comma will be changed to a semicolon
davidfor is offline   Reply With Quote