Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 09-04-2021, 03:00 PM   #1
Leseratte_10
Groupie
Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.Leseratte_10 ought to be getting tired of karma fortunes by now.
 
Posts: 183
Karma: 3587000
Join Date: Sep 2021
Device: PB Era, PB InkPad 3 Pro
Cancel book import from inside a FileTypePlugin

Hello,

is there a way for a Calibre FileTypePlugin to completely abort importing the current book (and ideally return an error message to the user)?

If I have a FileTypePlugin that's supposed to parse a custom file type and convert that into a format that Calibre understands, I'd like to be able to be like "Okay, this file the user is trying to import *is* in my custom file format (so don't try other file import plugins), but it's damaged / corrupted or otherwise unsuitable to use (so also don't import it into the database).

When I just return the original unmodified file path, or when I throw an Exception in the "run" function of my plugin class, Calibre just hands that book down to the next FileTypePlugin in line, or if there is none, imports it as-is. That results in an unusable book entry in Calibre that the user has to manually delete again.

Is there a way I can convey to calibre that the file is broken and to stop importing it and instead display a custom error message to the user?

I have read the plugin documentation and the plugin creation guide but I was unable to find that functionality in there.

Is that hidden somewhere, or is that something that Calibre doesn't support?
Leseratte_10 is offline   Reply With Quote
Old 09-04-2021, 06:42 PM   #2
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,717
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Moderator Notice
Moved from Plugins forum to Development forum

BR
BetterRed is offline   Reply With Quote
Advert
Old 09-04-2021, 10:10 PM   #3
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: 45,342
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
There isn't, filetype plugins cannot abort the input process and they definitely cannot interact witht he user, since they can be run in worker processes, in parallel, from the CLI, from the content server, etc.

I am assuming that your plugin is converting some custom format to a format calibre understands, so just have it return the original and that should be a good enough indication that your plugin failed.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching inside the book Sirtel Barnes & Noble NOOK 5 07-23-2019 07:24 PM
Import on Filename changes mid import due to book error Vortex Calibre 3 12-05-2014 11:49 AM
FileTypePlugin, config_widget, JSONConfig and Cancel Apprentice Alf Development 3 02-28-2013 12:41 PM
How to cancel 'book' generation if no articles found Big Al Recipes 3 01-31-2011 07:13 PM
Cover inside book luthar28 ePub 3 08-04-2010 05:32 PM


All times are GMT -4. The time now is 08:25 PM.


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