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 04-13-2011, 03:20 PM   #1
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,469
Karma: 5432724
Join Date: Nov 2009
Device: many
How to get version of Calibre being run from within plugin?

Hi,

Forgive me is I missed this in the plugin documentation, but how should a plugin determine which version of calibre it is running under when it is invoked.

For example, since .htmlz support was just added, I would like a file type plugin to create an .htmlz file and not a zip file but only for calibre version 0.7.55 and later. For earlier, I would like to have it stay with the .zip format so that one version of the plugin works for all versions of Calibre out there.

Is this currently possible and if so what is the best way to to get the current calibre version from within the plugin?

Thanks,

KevinH
KevinH is offline   Reply With Quote
Old 04-13-2011, 03:36 PM   #2
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,586
Karma: 2089838
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
from calibre.constants import numeric_version

Search Calibre for numeric_version to find the usages. It is basically a tuple like (0, 7, 54) that you can just do operator comparisons with. Plugin updater makes use of it.
kiwidude is online now   Reply With Quote
Old 04-13-2011, 04:34 PM   #3
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,469
Karma: 5432724
Join Date: Nov 2009
Device: many
Hi,

Quote:
Originally Posted by kiwidude View Post
from calibre.constants import numeric_version

Search Calibre for numeric_version to find the usages. It is basically a tuple like (0, 7, 54) that you can just do operator comparisons with. Plugin updater makes use of it.

Thank you!. That was exactly what I needed.

KevinH
KevinH is offline   Reply With Quote
Old 04-14-2011, 07:24 AM   #4
meme
Sigil developer
meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.
 
Posts: 1,275
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
You might want to consider just restricting your plugin to the minimum version of Calibre that supports the feature. Trying to support multiple versions of Calibre could become a headache and makes your testing that much harder.

To make sure the plugin does not run unless Calibre's version is at a certain level, add this to your InterfacActionBase class:

minimum_calibre_version = (0, 7, 55)
meme is offline   Reply With Quote
Old 04-14-2011, 07:42 AM   #5
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,586
Karma: 2089838
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
@meme - its a valid point - except he explicitly stated that he only wanted to have one version of the plugin which worked with all versions of Calibre

Being a file type plugin he isn't quite as restricted as working with the latest versions of Calibre as those of us working on the bleeding edge in the (mostly) gui plugin world
kiwidude is online now   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
Run plugin after "send to device" minicheck Development 1 02-26-2011 09:42 PM
DjVu Plugin for DR1000 - version 0.2 luite iRex 30 10-18-2010 03:49 PM
Run plugin before import dremo Plugins 6 01-09-2009 12:40 PM
should calibre_postinstall be run when just updating to new version? ould Calibre 1 12-08-2008 01:33 PM
[Apple]Java Embedding Plugin 0.9.2: Force java to run in browsers other than Safari Zire Lounge 4 05-24-2005 09:12 PM


All times are GMT -4. The time now is 12:32 AM.


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