A First Idea

For quite a while, I use the Calibre program to catalog my ebooks. Here I had the idea that it would be nice to be able to see the content of e-books in advance, in the details view. For this purpose, I did not want to abuse the field "Comments", but to use my own user-defined field. This field I gave the name "#content" (label to be: Content), which is displayed only in the details view, and there before the comments.

It quickly became apparent that the use of many e-books would require a lot of work. The question was: could one somehow automate the effort? To do this you would need to tap into a source for the content and generate the content.

An Intermediate Step: Generate a Contents Directory with Ruby

The source for the content was the bookmarks for the e-books. Since I was experimenting with the programming language Ruby at the same time, I came up with the idea of writing a Ruby script that would extract the bookmarks from an e-book and write them in a suitable format in a file. This was also possible for the two formats "EPUB" and "PDF". For the PDF format, however, additional software had to be used: the PDFtk server, a command line tool and free software.

The next step was then to hone the script and implement a couple of command line switches.

The "Fully Automated" Solution

Also this solution did not satisfy me completely. You had to

  • provide command line parameters, e.g. the path of the e-book
  • make the call
  • open the generated content in an editor
  • copy and paste the content into Calibre

Conclusion: So still a lot of manual operations

Therefore, the next idea was just consistent: You would have to have a plugin that generates the content - field by pressing a button. The result is a user interface plugin that automatically executes all steps via the UI command. In addition, this plugin is also configurable, so that the command line switches could also be varied.

And that is the result: the plugin "Define Content", which is also configurable in the call parameters.

Elimination of Dependencies

The plugin mentioned above had an error: It used an external tool Pdftk.exe and a Ruby installation was necessary to run certain Ruby scripts. These dependencies were eliminated by me, also thanks to friendly advice from Kovid Goyal. For the newest version of the plugin, there are no further requirements, only the latest Calibre version is to be used (from 4.0).

Another shortcoming was the incomprehensible name of the plugin. This was criticized in the Mobile Read Forum. So I decided to rename the plugin. It is now called: Toc View Generator.

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.

Ok