Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 08-26-2019, 10:03 AM   #1
Mick2nd
Member
Mick2nd began at the beginning.
 
Mick2nd's Avatar
 
Posts: 13
Karma: 10
Join Date: Aug 2019
Location: Germany, Jena
Device: Kindle & Android Tablet
Smile GUI Plugin "TOC View Generator" (was: Define Content)

Hello together,
shortly I created a Calibre plugin for myself. You can see its name in the title. Its purpose is to extract content information from ebooks (actually PDF and EPUB), to be more precise from the bookmarks, and to write it to a user defined "#content" field. This field is then displayed in the details view of Calibre just before Comments (configurable).
If you are interrested, you can visit my web page to get more information.
Also I append this plugin in this post.
It would be nice, if someone found it useful.
Attached Files
File Type: zip Define Content Plugin.zip (24.9 KB, 260 views)
Mick2nd is offline   Reply With Quote
Old 09-04-2019, 09:11 AM   #2
Mick2nd
Member
Mick2nd began at the beginning.
 
Mick2nd's Avatar
 
Posts: 13
Karma: 10
Join Date: Aug 2019
Location: Germany, Jena
Device: Kindle & Android Tablet
Bug fix and additional features

In the mean time I detected an error: an intermediate file was not overwritten - so the #content field was not updated after the first invocation of the command for an epub ebook.
So I provide this update.
Additional content is better logging, exception handling an a dialog to check the requirements.
I apologize for any problems.
Attached Files
File Type: zip Define-Content-Plugin-2.0.1.zip (66.7 KB, 244 views)

Last edited by theducks; 10-04-2019 at 05:22 AM. Reason: moved new ver PI here
Mick2nd is offline   Reply With Quote
Advert
Old 10-03-2019, 03:44 AM   #3
Mick2nd
Member
Mick2nd began at the beginning.
 
Mick2nd's Avatar
 
Posts: 13
Karma: 10
Join Date: Aug 2019
Location: Germany, Jena
Device: Kindle & Android Tablet
Progress in the work on the plugin

Hi, I want to post some news about the progress in the work on the plugin.
The following points seem remarkable to me:
  • the dependency on Ruby was completely removed
  • the work is done completely in the background
  • the work is integrated with Calibre's job system
  • the only remaining problem is that Pdftk does not provide any progress hints, so the progress display is somewhat rudimentary
The changes are actually not reflected on my web page, but I plan to do this soon.
Attached Files
File Type: zip Define-Content-Plugin-2.0.zip (66.6 KB, 259 views)
Mick2nd is offline   Reply With Quote
Old 10-03-2019, 07:42 AM   #4
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,987
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
from the description of the plugin on your website, this sounds like you want to extract the eBook from the eBook file and place it in a custom field in Calibre. Do I have this correct?
JSWolf is offline   Reply With Quote
Old 10-03-2019, 08:43 AM   #5
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: 43,859
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
FYI I ust added a function to extract the outline from PDF files to calibre itself, so no need to use pdftk.

Code:
from calibre.utils.podofo import get_outline
kovidgoyal is offline   Reply With Quote
Advert
Old 10-04-2019, 05:06 AM   #6
Mick2nd
Member
Mick2nd began at the beginning.
 
Mick2nd's Avatar
 
Posts: 13
Karma: 10
Join Date: Aug 2019
Location: Germany, Jena
Device: Kindle & Android Tablet
Hint for outline

Many thanks for Your hint. I just gave it a try. It works and I could see the generated list / dict structure.
One problem: during extraction the UI is blocked, although my code run in a ThreadedJob. With the pdftk this is not the case. Any additional hints?
Thanks!
Mick2nd is offline   Reply With Quote
Old 10-04-2019, 05:09 AM   #7
Mick2nd
Member
Mick2nd began at the beginning.
 
Mick2nd's Avatar
 
Posts: 13
Karma: 10
Join Date: Aug 2019
Location: Germany, Jena
Device: Kindle & Android Tablet
Reply to JSWolf

I do not extract the ebook from the ebook but the ebook's outline or bookmarks as it is called by Adobe reader.
The rest is correct.
Mick2nd is offline   Reply With Quote
Old 10-04-2019, 05:14 AM   #8
Mick2nd
Member
Mick2nd began at the beginning.
 
Mick2nd's Avatar
 
Posts: 13
Karma: 10
Join Date: Aug 2019
Location: Germany, Jena
Device: Kindle & Android Tablet
New version with bug fixes

Just after my yesterday's post I detected some bugs:
  • epub toc at different location than expected
  • NL whitespace in titles caused crash
  • exception handling not correct
  • bug using obsolete module file

That's why this new bug fix post.
Moderator Notice
Moved latest version to post #1 (a convention for releases)

Last edited by theducks; 10-04-2019 at 05:20 AM.
Mick2nd is offline   Reply With Quote
Old 10-04-2019, 06:02 AM   #9
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,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by Mick2nd View Post
I do not extract the ebook from the ebook but the ebook's outline or bookmarks as it is called by Adobe reader.
The rest is correct.
Firstly, I'd never noticed that Adobe Acrobat Reader used "bookmarks" for the table of contents. That is unfortunate, as everywhere else that I can think of, bookmarks are something the user adds as they read. Including Adobe Digital Editions which is used for ePubs.

But, I have to say your description of the plugin is terrible. When you first posted it, my reaction was similar to @JSWolf's. And I was only sure of what it did by reading the code. When I first saw it, I couldn't decide if "content information" was the metadata in the book, or text from the book. And the use of "bookmarks" added to the confusion as then I assumed you were extracting the user added bookmarks.
davidfor is offline   Reply With Quote
Old 10-04-2019, 06:18 AM   #10
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,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by Mick2nd View Post
  • epub toc at different location than expected
Looking at the code, you are assuming the NCX file is called "toc.ncx" and will either be in the OEPBS or root directory of the book. I have plenty of books where this would fail. You should be finding the file using the OPF.

Alternatively, calibre has methods to do this. Look at:

Code:
from calibre.ebooks.oeb.polish.container import EpubContainer
from calibre.ebooks.oeb.polish.toc import get_toc
Open the book using the first, and get the ToC using the latter. Or look at them to see how to find the appropriate file.
davidfor is offline   Reply With Quote
Old 10-05-2019, 03:46 AM   #11
Mick2nd
Member
Mick2nd began at the beginning.
 
Mick2nd's Avatar
 
Posts: 13
Karma: 10
Join Date: Aug 2019
Location: Germany, Jena
Device: Kindle & Android Tablet
How to change name of plugin

Quote:
Originally posted by davidfor
But, I have to say your description of the plugin is terrible.
Okay, You are right. I would like to change the name into a more meaningful one. Can we negotiate a new name for the plugin?
What's about:
  • TOC Generator
  • TOC View Generator
  • Table of Content Generator
  • Table of Content View Generator
I'll appreciate any hints.
Mick2nd is offline   Reply With Quote
Old 10-07-2019, 05:04 AM   #12
Mick2nd
Member
Mick2nd began at the beginning.
 
Mick2nd's Avatar
 
Posts: 13
Karma: 10
Join Date: Aug 2019
Location: Germany, Jena
Device: Kindle & Android Tablet
New name, new features, bug fixes

Hello,

in the mean time I decided to rename the plugin to "TOC View Generator". Hopefully people can better imagine what the plugin does seeing this name.
Also I added a few new features:
  • All dependencies from outside code are now removed
  • You can now choose the kind of heading markup, e.g. h3, h4, h5
  • You can now configure the name of the user defined field
  • You can also decide whether to store the view in the 'comments' field alternatively
  • And finally You can decide whether to replace, append, prepend the view content to the existing content
I also fixed bugs where I could detect them:
  • One could not select a new log file name because of an illegal reference
  • Further bugs I detected in the flow of code changes
A question arose regarding posting new releases:
How can I add attachments to previous posts? I could not find any button or link for it!
Attached Files
File Type: zip Toc-View-Generator-2.1.zip (72.6 KB, 232 views)
Mick2nd is offline   Reply With Quote
Old 10-07-2019, 07:48 AM   #13
thiago.eec
Guru
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 927
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
Quote:
Originally Posted by Mick2nd View Post
Hello,

in the mean time I decided to rename the plugin to "TOC View Generator".
Some moderator could now change the title of the thread.

Quote:
Originally Posted by Mick2nd View Post
A question arose regarding posting new releases:
How can I add attachments to previous posts? I could not find any button or link for it!
You can click on 'edit' on the bottom right corner of the first post. Then, click on 'Go advanced' and 'Manage Attachments'.
thiago.eec is offline   Reply With Quote
Old 10-07-2019, 10:57 AM   #14
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,804
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Moderator Notice
Name changed.

I will let the OP manage the attachment. It (releases) must be in the first post IF Calibre notifications are to work. Betas should NOT be in post 1
Use Advanced Edit mode in MR forums. Lots more options become visible.
theducks is offline   Reply With Quote
Old 10-07-2019, 10:58 AM   #15
Mick2nd
Member
Mick2nd began at the beginning.
 
Mick2nd's Avatar
 
Posts: 13
Karma: 10
Join Date: Aug 2019
Location: Germany, Jena
Device: Kindle & Android Tablet
Edit not found

Quote:
Originally Posted by thiago.eec View Post
You can click on 'edit' on the bottom right corner of the first post. Then, click on 'Go advanced' and 'Manage Attachments'.
Thank's for Your info. Unfortunately I cannot see any Edit button in my post or below it.
Mick2nd is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] View Manager kiwidude Plugins 414 04-13-2024 01:41 PM
[GUI Plugin] Save Virtual Libraries To Column (GUI) chaley Plugins 14 04-04-2021 05:25 AM
[GUI Plugin] APNX Generator user_none Plugins 92 10-25-2020 01:24 PM
[GUI Plugin] Auto Datestamp and View eater Plugins 3 04-08-2020 06:08 PM
Bug or feature of the TOC generator? Artha Sigil 10 11-26-2011 11:03 PM


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


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