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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 03-08-2013, 10:18 AM   #16
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,262
Karma: 3675895
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Quote:
Originally Posted by kovidgoyal View Post
I've added an interface to calibre-debug to make running plugins even easier.
Nifty. That'll be very nice. What are the limitations? Access to the library db would be nice, but I don't expect it given the issues with concurrent update.
JimmXinu is offline   Reply With Quote
Old 03-08-2013, 10:18 AM   #17
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,262
Karma: 3675895
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Glad it's working for you. As per Kovid's new plugin CLI feature, I'll be adding CLI via calibre to my plugins in future.
Quote:
Originally Posted by cakiran View Post
One more question which is quite unrelated to this issue but related to epubs. Is there any easy way to find out the total number of pages of a epub?
Count Pages Plugin
JimmXinu is offline   Reply With Quote
Old 03-08-2013, 10:20 AM   #18
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,659
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Whose pages? EPUB does not have 'pages'.

Kiwidude made the Count Pages PI with the ability to chose from a number of differing count algorithms.
theducks is offline   Reply With Quote
Old 03-08-2013, 10:36 AM   #19
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,744
Karma: 22446736
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by JimmXinu View Post
Nifty. That'll be very nice. What are the limitations? Access to the library db would be nice, but I don't expect it given the issues with concurrent update.
There are no limitations, you can do anything that any of calibre's own command line utilities can do.
kovidgoyal is offline   Reply With Quote
Old 03-08-2013, 06:23 PM   #20
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,262
Karma: 3675895
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Kovid,

I've been playing with this and with a bit of work I'm able to get my existing CLI interfaces to run using 'calibre-debug --run-plugin'. That's pretty cool.

However, while figuring out how to get at the config preferences my PI has stored in db.prefs.get/set_namespaced, I realized that calibre-debug doesn't have the '--with-library' option that calibredb does. I can relatively easily get the db for the library last used in the gui, but not a specified one.

If CLI plugins are meant to be able to access/update library db's, might it be better to make run_plugin a command under calibredb and pass the db in to cli_main?

I finally made myself a working src dir for calibre, so I can do the coding for this approach and submit it for your review, if you like.
JimmXinu is offline   Reply With Quote
Old 03-08-2013, 10:10 PM   #21
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,744
Karma: 22446736
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If your plugin needs access to the db, you can add a --with-library option to your plugin. Then do

calibre-debug -r "plugin name" -- --with-library /whatever
kovidgoyal is offline   Reply With Quote
Old 03-14-2013, 01:29 PM   #22
cakiran
Member
cakiran began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Mar 2013
Device: Bluefire reader, samsung galaxy s3
Split on basis of number of words?

Quote:
Originally Posted by JimmXinu View Post
Glad it's working for you. As per Kovid's new plugin CLI feature, I'll be adding CLI via calibre to my plugins in future.

Count Pages Plugin
Hi Jim,

Is there any option to split the epub on the basis of words or page numbers?
cakiran is offline   Reply With Quote
Old 03-14-2013, 01:42 PM   #23
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,262
Karma: 3675895
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Quote:
Originally Posted by cakiran View Post
Is there any option to split the epub on the basis of words or page numbers?
Not in EpubSplit.

Word count is somewhat variable depending on who's doing the counting and page numbers are vary widely, again depending on who's doing the counting.
JimmXinu is offline   Reply With Quote
Old 03-14-2013, 01:45 PM   #24
cakiran
Member
cakiran began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Mar 2013
Device: Bluefire reader, samsung galaxy s3
Thanks for the clarification.

Is there any way to do this on the basis of pages? Can we cut out pages within a chapter?
Is that possible at all?
cakiran is offline   Reply With Quote
Old 03-14-2013, 01:49 PM   #25
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,262
Karma: 3675895
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
I'm not aware of any existing way. Frankly, I can't imagine why you'd want to.
JimmXinu is offline   Reply With Quote
Old 03-14-2013, 03:02 PM   #26
cakiran
Member
cakiran began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Mar 2013
Device: Bluefire reader, samsung galaxy s3
This is for creating previews or excerpts out of these books.
cakiran is offline   Reply With Quote
Old 03-14-2013, 03:10 PM   #27
cakiran
Member
cakiran began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Mar 2013
Device: Bluefire reader, samsung galaxy s3
Can you think of any vague idea of how this may be proceeded with? Like splitting on the basis of number of words or pages?
cakiran is offline   Reply With Quote
Old 03-14-2013, 03:33 PM   #28
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,262
Karma: 3675895
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
I can think of ways that might do it, sure.

You could look inside the Count Pages plugin for ideas on how to count pages and words to find where you want to split.

After that, you could look at the splitHtml() function in my epubsplit.py for ideas on how to extract only desired ranges of HTML.

Or you could maybe use epubsplit as-is by Inserting an anchor tag at the point you want to split (found by counting words/pages) and add it to the TOC. Then use epubsplit.
JimmXinu is offline   Reply With Quote
Old 03-14-2013, 04:47 PM   #29
cakiran
Member
cakiran began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Mar 2013
Device: Bluefire reader, samsung galaxy s3
Thank you for the ideas. Very helpful.
cakiran is offline   Reply With Quote
Old 03-19-2013, 04:05 PM   #30
cakiran
Member
cakiran began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Mar 2013
Device: Bluefire reader, samsung galaxy s3
Step by step instruction please

Quote:
Originally Posted by JimmXinu View Post
Or you could maybe use epubsplit as-is by Inserting an anchor tag at the point you want to split (found by counting words/pages) and add it to the TOC. Then use epubsplit.
Can you please give step by step of how to do this. As I understand
1. Get the word count and get the page, at the html page which need to be split add a anchor tag with some text like

<html>
....
<body>
<p>lorunm dfdsfds hjfldsf</p>
<a>cuthere</a>
<p>lorunm dfdsfds hjfldsf</p>
</body>
</html>

Now i ran this through the epubsplit options generator and it did nothing without adding anything to TOC.

Then add this do TOC? You mean the Table of contents page? Add a new entry? How can i do that. Step by step will help greatly.

Thanks.
cakiran is offline   Reply With Quote
Reply

Tags
.net, automate, calibre, commandline, epubsplit

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] EpubSplit JimmXinu Plugins 411 02-11-2024 05:35 PM
Automate Calibre Tagging ohemeffgee Library Management 1 11-11-2012 06:56 AM
Any way to automate editting metadata? louwin Library Management 4 04-24-2012 06:58 PM
Help Merging Multiple Small Epubs into One Large Epub kazbates Workshop 14 09-15-2011 02:18 AM
I am looking for a tool that could automate convertion of... astra Workshop 24 08-30-2009 06:38 AM


All times are GMT -4. The time now is 06:10 AM.


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