View Single Post
Old 07-22-2022, 04:06 AM   #2
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
Firstly, the custom field will be saved to the books metadata when you do a save-to-disk or send-to-device. Calibre updates all the metadata and another instance of calibre can read that data when you add the book to the library.

But, you can modify the core metadata fields with a metadata plugboard. These get run when calibre is sending the book outside the library. They are a template that can modify the field with other information. I do this to add information to the comments field that is not displayed on the Kobo devices. The template I use is:

Code:
program:
comment=field('comments');
rating_str = test($rating, strcat('<p><b>Rating:</b> ', rating_as_stars($rating), '</p>'),'');
kobo_last_read_str = test($#kobo_last_read,strcat('<p><b>Last Read:</b> ', $#kobo_last_read, '</p>'),'');
word_count = test(field('#words'),strcat('<b>Word count:</b> ', field('#words')),'');
page_count = test(field('#pages'),strcat('<b>Page count:</b> ', field('#pages')),'');
counts = test(strcat(word_count,page_count),'<p>','');
counts = test(word_count,strcat(counts,word_count),counts);
counts = test(word_count,test(page_count,strcat(counts,' '),counts),counts);
counts = test(page_count,strcat(counts,page_count),counts);
counts = test(strcat(word_count,page_count),strcat(counts,'</p>'),'');
extradata = strcat(rating_str,kobo_last_read_str,counts);
comment=strcat(comment,test(extradata,strcat('<hr/>',extradata),""));
re(comment, '\s+', ' ');
That adds the page count, word count, my rating and when I last read it to the comment field. The complication in it is the checking to see if the value exists and then adding tags to format it a bit better.
davidfor is offline   Reply With Quote