![]() |
#1 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Jul 2017
Device: none
|
Get Calibre version from the command line
Hi. We have a need to know which version of Calibre is installed without actually running it. (We're using calibredb to create a new ebook from another application.) Apparently, there is a difference between versions 1, 2 and version 3 in what
calibredb add -d filename calibredb list -f size produces. In versions 1 and 2, the just added ID was in the next to last line. In version 3 it is the last line. We'd like to be able to know the version of Calibre being used so we can know which line to use with the calibredb list command. Thanks. |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,166
Karma: 1410083
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
|
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Jul 2017
Device: none
|
Thanks, but with Calibre 3.5, when I use
calibre --version on Windows, there is nothing shown. It's silent. |
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,166
Karma: 1410083
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
|
take calibredb --version
![]() and your example is a little hint for Kovid ![]() Edit: @Kovid, ebook-edit, ebook-viewer, lrfviewer have the same behavior as calibre --version Last edited by Divingduck; 07-28-2017 at 05:33 PM. |
![]() |
![]() |
![]() |
#5 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,660
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
IIRC you can use the WMIC command to get the version number of an .exe (or .dll). It's been a long time since I used WMIC, but it should be available in all versions of Windows - the so-called 'instrumentation' features wouldn't work without it.
BR |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,251
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Yes, there is a reason windows is named windows. Basically, in windows programs can be either console or "window" programs. The latter are not supposed to output to stdout.
|
![]() |
![]() |
![]() |
#7 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Jul 2017
Device: none
|
Thanks.
I had not tried using calibredb --version That works on Windows, Linux, and Mac. So we're all set. |
![]() |
![]() |
![]() |
#8 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 440
Karma: 77256
Join Date: Sep 2011
Device: none
|
Hello,
is there a quicker way to get the version number from the command-line, Python, or some other way such as reading some json value? Reporting the version from "calibre --version" takes a bit of time and I'd prefer something quicker like parsing json. |
![]() |
![]() |
![]() |
#9 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,251
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
calibre-debug -c "from calibre.constants import __version__; print(__version)"
that's the quickest you are going to get. version information is not stored in JSON, but in compiled bytecode. |
![]() |
![]() |
![]() |
#10 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 440
Karma: 77256
Join Date: Sep 2011
Device: none
|
Thank you. That is an improvement. I'm unsure how accurate is using "time" from the command-line. On macOS on my system, it measures as ~.05s. In my use, that is a measurable increase that will affect UI updates. As my need is only macOS, maybe I can detect version number –*I need only to know it's using the updated viewer –, by checking for some existing file that's new with 4.x. Would you consider adding major version to a main json preference file? I haven't yet tried to figure out what will be potentially quickest (using Go) though I will try soon.
|
![]() |
![]() |
![]() |
#11 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,251
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
On macOS you can get it from Info.plist in the app bundle.
|
![]() |
![]() |
![]() |
#12 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 440
Karma: 77256
Join Date: Sep 2011
Device: none
|
ah yes.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to "Install Command Line Tools" on version 2.37.1 | SilverWinter | Calibre | 13 | 12-08-2015 07:45 AM |
Calibre with command line ? | Laurent06 | Conversion | 2 | 11-09-2014 12:37 AM |
Command line—HOW? (Mac OS X version) | Deep Cover | Calibre | 3 | 04-21-2013 03:49 PM |
Calibre Command Line Conversion | bmwr1200c | Calibre | 1 | 08-10-2011 07:04 PM |
Autotagging with Calibre (command line) | erion | Calibre | 11 | 08-28-2010 01:33 PM |