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 05-22-2017, 04:29 PM   #1
Barafu
Junior Member
Barafu began at the beginning.
 
Posts: 7
Karma: 10
Join Date: May 2014
Device: many
Can't find info on store plugins.

I want to write a plugin that would allow to extract a book from remote database and copy it into Calibre library. Could I please get advise on how to best implement it?
I think I should use a store plugin to avoid creating my own GUI with the same functionality. But I can not find info on their API or a source code of one to use as a sample. They are not on Plugins subforum, where are they?
Do I provide myself or can I override the "Download" command functionality? Because I will not have a straight URL and would have to decode the file first.
Finally, if I have a name of a local file in plugin, can I use some Calibre commands to check if it is a book and read its metadata without adding it to the library, or would I have to implement it myself?
Thanks.
Barafu is offline   Reply With Quote
Old 05-22-2017, 04:48 PM   #2
Barafu
Junior Member
Barafu began at the beginning.
 
Posts: 7
Karma: 10
Join Date: May 2014
Device: many
Correction

I meant to say, I have not found description of store plugin API and use a source code of one as an example.
Barafu is offline   Reply With Quote
Advert
Old 05-22-2017, 10:38 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: 43,844
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The API for store plugins is trivial, look in the calibre source code in the stores/ directory
kovidgoyal is offline   Reply With Quote
Old 05-23-2017, 12:02 AM   #4
Barafu
Junior Member
Barafu began at the beginning.
 
Posts: 7
Karma: 10
Join Date: May 2014
Device: many
Yes, I have seen them and got the basics, thanks. Let me clarify my question. I do the search and get the results, but there are no direct download links. Instead I have to decode data myself to retrieve a book file.
  • I have to do the downloading in the open() method of my plugin because there is no way to provide a customized method to download a book. Right?
  • After I unpack a book file and have it in temporary location, how do I add it to Calibre database? I could use a system call to use Calibre CLI to do it, I think, but I hope there is an API function for this.
  • Finally, can I use Calibre API in my plugin to read metadata from that file prior to adding it to Calibre? I need to check that it is actually the book that was asked for, because the result really could be wrong.
Barafu is offline   Reply With Quote
Old 05-23-2017, 12:10 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,844
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Store plugins can do only one thing, provide a list of results after searching a website. You want to do all the other things, you need to create a user interface plugin.

And as for APIs to add books to calibre and read metadata, they are present and can be used from user interface plugins.

Simply use one of the methods from self.gui.iactions['Add Books'] (which is the Add Books builtin user interface plugin) to add a file to calibre, reading metadata etc is handled automatically.
kovidgoyal is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find copyright info on WW2 book? crankypants Workshop 3 12-31-2015 04:41 PM
Where would I find info about . . . crich70 Writers' Corner 4 09-17-2014 03:52 PM
Can't find my plugins? Kraftwerk Plugins 2 10-12-2011 05:07 PM
Calibre can't find zipped plugins Henry Flower Calibre 2 06-14-2011 11:10 AM


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


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