Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 04-30-2014, 10:56 PM   #1
Saioko
Member
Saioko began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Apr 2013
Device: Digma s602
Converting to fb2 - adding annotation.

What code should I use to add <annotation> to fb2 file header?

I tried using this:
Code:
        annotationtext = u''
        annotationtext = self.oeb_book.metadata['description'][0].value
Plus some replacing, which gives me in "annotationtext" something like "<p>Blah-blah-blah</p>".

But when I try to add it to fb2 header with this:
Code:
                        <book-title>%(title)s</book-title>
                        <annotation>%(annotationtext)s</annotation>
I get an error message.
Quote:
File "/home/katya/calibre/src/calibre/ebooks/fb2/fb2ml.py", line 56, in extract_content
return self.fb2mlize_spine()
File "/home/katya/calibre/src/calibre/ebooks/fb2/fb2ml.py", line 59, in fb2mlize_spine
output = [self.fb2_header()]
File "/home/katya/calibre/src/calibre/ebooks/fb2/fb2ml.py", line 253, in fb2_header
</description>\n''') % metadata
KeyError: u'annotationtext'

P.S. I know it is possible, because in past I had "Update metadata" option turned on during save-to-disk and those files had annotation. But they also messed up my author edits.

Last edited by Saioko; 04-30-2014 at 10:58 PM.
Saioko is offline   Reply With Quote
Old 04-30-2014, 11:06 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,154
Karma: 5381911
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You are not using the official calibre binaries. Use those. And FB2 output is largely unmaintained. So if you want answers to questions, the only way is to read the source for yourself.
kovidgoyal is online now   Reply With Quote
Old 05-01-2014, 12:02 AM   #3
Saioko
Member
Saioko began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Apr 2013
Device: Digma s602
Thank you!
It took me only an hour to translate that you meant "Use metadata['annotationtext'] = u' instead of annotationtext = u'' "
Saioko is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
When adding FB2 use today as date and not the file timestamp, ¿possible? elchamaco Calibre 5 01-15-2012 09:05 AM
Failure converting zip to fb2 rbruce1314 Calibre 2 11-17-2010 05:39 PM
Converting PDF - FB2 issue (0.72) kgn Calibre 3 06-16-2010 07:22 AM
error converting from fb2 format jomaweb Calibre 3 04-23-2010 05:41 AM
TOC not created converting from FB2 regul8or Calibre 1 08-03-2009 12:26 PM


All times are GMT -4. The time now is 01:35 PM.


MobileRead.com is a privately owned, operated and funded community.