| 
			
			 | 
		#16 | 
| 
			
			
			
			 Plugin Developer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,136 
				Karma: 5005503 
				Join Date: Dec 2011 
				Location: Midwest USA 
				
				
				Device: Kobo Clara Colour running KOReader 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#17 | |
| 
			
			
			
			 Plugin Developer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,136 
				Karma: 5005503 
				Join Date: Dec 2011 
				Location: Midwest USA 
				
				
				Device: Kobo Clara Colour running KOReader 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			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: 
	
  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| Advert | |
| 
         | 
    
| 
			
			 | 
		#18 | 
| 
			
			
			
			 Well trained by Cats 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,267 
				Karma: 61916422 
				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.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#19 | 
| 
			
			
			
			 creator of calibre 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609 
				Karma: 28549044 
				Join Date: Oct 2006 
				Location: Mumbai, India 
				
				
				Device: Various 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#20 | 
| 
			
			
			
			 Plugin Developer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,136 
				Karma: 5005503 
				Join Date: Dec 2011 
				Location: Midwest USA 
				
				
				Device: Kobo Clara Colour running KOReader 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			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.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| Advert | |
| 
         | 
    
| 
			
			 | 
		#21 | 
| 
			
			
			
			 creator of calibre 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609 
				Karma: 28549044 
				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  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#22 | |
| 
			
			
			
			 Member 
			
			![]() Posts: 15 
				Karma: 10 
				Join Date: Mar 2013 
				
				
				
				Device: Bluefire reader, samsung galaxy s3 
				
				
				 | 
	
	
	
		
		
			
			 
				
				Split on basis of number of words?
			 
			Quote: 
	
 Is there any option to split the epub on the basis of words or page numbers?  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#23 | 
| 
			
			
			
			 Plugin Developer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,136 
				Karma: 5005503 
				Join Date: Dec 2011 
				Location: Midwest USA 
				
				
				Device: Kobo Clara Colour running KOReader 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#24 | 
| 
			
			
			
			 Member 
			
			![]() 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?  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#25 | 
| 
			
			
			
			 Plugin Developer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,136 
				Karma: 5005503 
				Join Date: Dec 2011 
				Location: Midwest USA 
				
				
				Device: Kobo Clara Colour running KOReader 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I'm not aware of any existing way.  Frankly, I can't imagine why you'd want to.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#26 | 
| 
			
			
			
			 Member 
			
			![]() 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.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#27 | 
| 
			
			
			
			 Member 
			
			![]() 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?
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#28 | 
| 
			
			
			
			 Plugin Developer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,136 
				Karma: 5005503 
				Join Date: Dec 2011 
				Location: Midwest USA 
				
				
				Device: Kobo Clara Colour running KOReader 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			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.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#29 | 
| 
			
			
			
			 Member 
			
			![]() Posts: 15 
				Karma: 10 
				Join Date: Mar 2013 
				
				
				
				Device: Bluefire reader, samsung galaxy s3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Thank you for the ideas. Very helpful.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#30 | |
| 
			
			
			
			 Member 
			
			![]() Posts: 15 
				Karma: 10 
				Join Date: Mar 2013 
				
				
				
				Device: Bluefire reader, samsung galaxy s3 
				
				
				 | 
	
	
	
		
		
			
			 
				
				Step by step instruction please
			 
			Quote: 
	
 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.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
            
| Tags | 
| .net, automate, calibre, commandline, epubsplit | 
| Thread Tools | Search this Thread | 
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| [GUI Plugin] EpubSplit | JimmXinu | Plugins | 459 | 07-31-2025 10:32 AM | 
| Automate Calibre Tagging | ohemeffgee | Library Management | 1 | 11-11-2012 07:56 AM | 
| Any way to automate editting metadata? | louwin | Library Management | 4 | 04-24-2012 07:58 PM | 
| Help Merging Multiple Small Epubs into One Large Epub | kazbates | Workshop | 14 | 09-15-2011 03:18 AM | 
| I am looking for a tool that could automate convertion of... | astra | Workshop | 24 | 08-30-2009 07:38 AM |