View Single Post
Old 07-09-2011, 04:21 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,453
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Silek View Post
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="{&quot;
is_category&quot;: true, &quot;
#extra#&quot;: null, &quot;
kind&quot;: &quot;
field&quot;, &quot;
is_custom&quot;: true, &quot;
is_csp&quot;: false, &quot;
colnum&quot;: 7, &quot;
column&quot;: &quot;value&quot;, &quot;
rec_index&quot;: 28, &quot;
search_terms&quot;: [&quot;#enum&quot;], &quot;
link_column&quot;: &quot;value&quot;, &quot;
is_multiple2&quot;: {}, &quot;
is_multiple&quot;: null, &quot;
datatype&quot;: &quot;enumeration&quot;, &quot;
#value#&quot;: &quot;def&quot;, &quot;
category_sort&quot;: &quot;value&quot;, &quot;
table&quot;: &quot;custom_column_7&quot;, &quot;
is_editable&quot;: true, &quot;
label&quot;: &quot;enum&quot;, &quot;
display&quot;: {&quot;use_decorations&quot;: 2, &quot;enum_values&quot;: [&quot;def&quot;, &quot;one&quot;, &quot;two&quot;, &quot;five&
quot;, &quot;no&quot;]}, &quot;
name&quot;: &quot;énum&quot;
}"/>
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.
chaley is offline   Reply With Quote