View Single Post
Old 04-23-2019, 12:09 AM   #6
ceridwen
Enthusiast
ceridwen began at the beginning.
 
Posts: 36
Karma: 10
Join Date: Feb 2017
Device: Kobo Aura H2O
Quote:
Originally Posted by ilovejedd View Post
For fixed data custom columns yes. You need to look at how exactly the custom column is formatted in the OPF. Best way is to create the custom columns in the Calibre library and populate them with your data. Then study the metadata.opf inside the book folder.

I haven't tried it with columns built from other columns but that shouldn't really matter.
Experimentally, populating the .opf file inside an .epub doesn't cause Calibre to read the metadata contained in that file, regardless of whether it's created as a generic tag using
Code:
<meta name="foo" content="bar"/>
or using the tag construction Calibre does in the metadata.opf attached to an epub file:
Code:
<meta name="calibre:user_metadata:#test" content="{&quot;display&quot;: {&quot;description&quot;: &quot;&quot;, &quot;is_names&quot;: true}, &quot;colnum&quot;: 1, &quot;column&quot;: &quot;value&quot;, &quot;#extra#&quot;: null, &quot;table&quot;: &quot;custom_column_1&quot;, &quot;is_category&quot;: true, &quot;rec_index&quot;: 22, &quot;is_csp&quot;: false, &quot;#value#&quot;: [&quot;foo, bar&quot;], &quot;category_sort&quot;: &quot;value&quot;, &quot;is_multiple&quot;: &quot;|&quot;, &quot;is_multiple2&quot;: {&quot;cache_to_list&quot;: &quot;|&quot;, &quot;ui_to_list&quot;: &quot;&amp;&quot;, &quot;list_to_ui&quot;: &quot; &amp; &quot;}, &quot;datatype&quot;: &quot;text&quot;, &quot;name&quot;: &quot;Test&quot;, &quot;is_editable&quot;: true, &quot;kind&quot;: &quot;field&quot;, &quot;label&quot;: &quot;test&quot;, &quot;search_terms&quot;: [&quot;#test&quot;], &quot;link_column&quot;: &quot;value&quot;, &quot;is_custom&quot;: true}"/>
For ebooks I'm more or less generating myself, I can create the dc:subject tags when I build the rest of it. For AO3, since dc:subject tags are already there, I probably have to copy the existing epub and rewrite the content.opf file. Because I'm going to want to store the results of tag processing locally (because it requires calling out to the Internet), there's really no way around keeping two epubs. The only other thing I could do is use calibredb to do the insertion in the Calibre database (which I think does allow me to set custom fields) and then have a separate file that caches the results of tag processing.
ceridwen is offline   Reply With Quote