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 10-25-2016, 04:42 AM   #1
Terisa de morgan
Wizard
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 3,695
Karma: 3554614
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Aura, Kobo Mini, Kobo Aura HD, elephone, iPad, Galaxy Tab3 8
Getting BookId from viewer plugin

Hi,

I'm trying to make a plugin for updating some metadata when a book is loaded inside the viewer. My problem at this moment is that I don't know how to get the book id (or the title and author, is the same) from inside the plugin. I don't know if it is not possible or I haven't looked at the proper point.

Thanks in advance
Terisa de morgan is offline   Reply With Quote
Old 10-25-2016, 09:58 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: 29,661
Karma: 7528425
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Viewer plugins have no access to the database. They cannot since the the viewer can be run on books outside of a calibre library as well. I assume what you want to do is have calibre run embed metadata automatically when you click the view button?

If so, create a calibre plugin that duplicates the builtin view plugin, except that it run the embed metadata plugin before opening the file in the viewer. Then you can use this plugin to replace the view button in your calibre.
kovidgoyal is offline   Reply With Quote
 
Advertisement
Old 10-25-2016, 11:09 AM   #3
Terisa de morgan
Wizard
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 3,695
Karma: 3554614
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Aura, Kobo Mini, Kobo Aura HD, elephone, iPad, Galaxy Tab3 8
I'll try to see how to implement this, I'm not so sure I'm able to do it.
Terisa de morgan is offline   Reply With Quote
Old 10-25-2016, 11:19 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: 29,661
Karma: 7528425
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It's very easy if you just modify the calibre source code instead of trying to do it via a plugin. All you have to do is modify the view_format_by_id() method in actions/view.py add a call to db.embed_metadata() to update the metadata in the book format.
kovidgoyal is offline   Reply With Quote
Old 10-25-2016, 11:31 AM   #5
Terisa de morgan
Wizard
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 3,695
Karma: 3554614
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Aura, Kobo Mini, Kobo Aura HD, elephone, iPad, Galaxy Tab3 8
Quote:
Originally Posted by kovidgoyal View Post
It's very easy if you just modify the calibre source code instead of trying to do it via a plugin. All you have to do is modify the view_format_by_id() method in actions/view.py add a call to db.embed_metadata() to update the metadata in the book format.
Yes, that's quite easy for sure. The problem here is to maintain that code across versions (I'm doing it for a metadata plugboard adaptation and some ongoing catalog modifications...), as I don't usually run calibre from source.

Thank you very much, really
Terisa de morgan is offline   Reply With Quote
Old 10-25-2016, 12:03 PM   #6
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: 29,661
Karma: 7528425
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I suggest you setup calibre to run from source. Otherwise, you'd essentially have to clone parts of the builtin view plugin from actions/view.py into your own plugin.
kovidgoyal is offline   Reply With Quote
Old 10-25-2016, 01:27 PM   #7
Terisa de morgan
Wizard
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 3,695
Karma: 3554614
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Aura, Kobo Mini, Kobo Aura HD, elephone, iPad, Galaxy Tab3 8
Yes, I agree. Thank you again.
Terisa de morgan is offline   Reply With Quote
Old 10-26-2016, 05:54 PM   #8
Terisa de morgan
Wizard
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 3,695
Karma: 3554614
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Aura, Kobo Mini, Kobo Aura HD, elephone, iPad, Galaxy Tab3 8
Quote:
Originally Posted by kovidgoyal View Post
Viewer plugins have no access to the database. They cannot since the the viewer can be run on books outside of a calibre library as well. I assume what you want to do is have calibre run embed metadata automatically when you click the view button?

If so, create a calibre plugin that duplicates the builtin view plugin, except that it run the embed metadata plugin before opening the file in the viewer. Then you can use this plugin to replace the view button in your calibre.
Thank you for this idea, I haven't done exactly the same but a plugin which modifies metadata and calls to the builtin view plugin. Now it's working (not yet but it is in its way).

Thank you again.
Terisa de morgan 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
[Viewer Plugin] Text to Speech chye Plugins 10 07-04-2016 10:22 AM
[Viewer Plugin] Get selected text on right click. jverrone3 Development 1 03-27-2015 11:57 PM
dr1000s cbr/cbz viewer or plugin? maikarl iRex 1 03-14-2015 03:17 PM
viewer plugin? dhunter Plugins 1 03-08-2012 11:10 PM
Perfect Viewer PDF Plugin GJSmith Kobo Tablets 9 12-01-2011 03:03 PM


All times are GMT -4. The time now is 02:53 PM.


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