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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 01-27-2019, 11:57 PM   #1
minektur
Junior Member
minektur began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jan 2019
Device: fbreader/android
plugin api call to do editmetadata->merge functions?

I'm playing around with a plugin that does some custom duplicate finding (yeah I know about the existing duplicate finder plugin) and I'd like to, in some cases be able to make a db api call that does the same thing as 'edit metadata'->'merge' from the menu or 'M' keypress.

Is that function exposed via the api that plugins can call?
minektur is offline   Reply With Quote
Old 01-28-2019, 01:08 AM   #2
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: 34,124
Karma: 10261492
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You can do anything calibre itself can do from a plugin, there is no API that is not accessible. For instance if you want to trigger the merge action from your plugin, you can do:

Code:
self.gui.iactions['Edit metadata'].merge_books()
see the code of the merge_books() function in edit_metadata.py in the calibre source code for parameters to pass or if you want to manually do some things that function does.
kovidgoyal is offline   Reply With Quote
Old 01-28-2019, 08:27 AM   #3
minektur
Junior Member
minektur began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jan 2019
Device: fbreader/android
So, looking at that code, I want to do this approximately:


self.add_formats(dest_id, self.formats_for_books(rows))
self.merge_metadata(dest_id, src_ids)
self.delete_books_after_merge(src_ids)

Can I just import those (and any they use) methods from that file?

Are they already accessible somewhere? deep in the self.gui object?
minektur is offline   Reply With Quote
Old 01-28-2019, 09:45 AM   #4
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: 34,124
Karma: 10261492
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
self.gui.iactions['Edit metadata']
kovidgoyal is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Suggestion: Plugin API exposing basic metadata AlPe Plugins 11 12-14-2015 02:05 PM
calibre's new plugin API kovidgoyal Plugins 26 05-07-2011 02:43 PM
Small Change to Metadata Source plugin API kovidgoyal Development 2 04-25-2011 02:55 PM
Metadata scraper plugin api kiwidude Development 5 03-06-2011 11:58 AM
Ubook plugin api Dopedangel Reading and Management 0 08-25-2007 06:54 AM


All times are GMT -4. The time now is 04:05 PM.


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