Quote:
Originally Posted by Silek
When I run calibredb set_metadata on the OPF file I generate, I do not get an error, but I also do not get the user columns set.
|
Command line set_metadata will update custom columns.
The format for custom columns in the OPF is complicated. My guess is that you have it wrong and the data is being ignored. Change a book using the GUI to have the data you expect when you run set_metadata, then look at the metadata.opf file for the book. Ensure that your script generates exactly the same stuff.
Quote:
What is strange to me also is when I add fields to the user columns in the GUI, then run show_metadata, I do not see the entries in the OPF file for the user column.
|
I see them in both the OPF and columnar output. For example, dumping the OPF for one of my books in my test library I get
Spoiler:
Code:
<meta name="calibre:user_metadata:#enum" content="{"
is_category": true, "
#extra#": null, "
kind": "
field", "
is_custom": true, "
is_csp": false, "
colnum": 7, "
column": "value", "
rec_index": 28, "
search_terms": ["#enum"], "
link_column": "value", "
is_multiple2": {}, "
is_multiple": null, "
datatype": "enumeration", "
#value#": "def", "
category_sort": "value", "
table": "custom_column_7", "
is_editable": true, "
label": "enum", "
display": {"use_decorations": 2, "enum_values": ["def", "one", "two", "five&
quot;, "no"]}, "
name": "énum"
}"/>
However, during testing I did find a bug in the OPF renderer that has been there for over a year (!). The generated OPF has empty values for tags-like custom columns. If you are testing exclusively with an is_multiple datatype, that would explain you not seeing. Non-multiple columns do render values correctly, as shown above. Note that the columnar output does not suffer from this problem.