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 10-23-2019, 07:00 PM   #1
apducer
Junior Member
apducer began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Oct 2019
Device: Kindle
Question Use calibre ebook-convert as a Python Module

Hi,
I'm building a tool that runs on the server and needs to convert ebooks to other formats. The problem is that I can't run the calibre CLI (and use the ebook-convert command) on the server, so I want to run the ebook conversion of calibre as a python module.
Is there an easy way to do this? Is there any documentation that I may have missed?
Also, I would like to upload to the server the least amount of code of the calibre source.

Thanks!
apducer is offline   Reply With Quote
Old 10-23-2019, 10:30 PM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by apducer View Post
The problem is that I can't run the calibre CLI (and use the ebook-convert command) on the server
Why not?

Quote:
, so I want to run the ebook conversion of calibre as a python module.
Is there an easy way to do this? Is there any documentation that I may have missed?
Also, I would like to upload to the server the least amount of code of the calibre source.
Why do you need to "upload the least amount of code"?

The biggest thing you'll be uploading isn't even calibre itself, it is Qt5 WebEngine, used in PDF output, and Qt5 Svg used for image transforms in any conversion, which means you need PyQt5 installed.

It's not possible to install only part of calibre, at any rate. And there isn't really much documentation for running the underlying bits yourself, but you could check out the usage of calibre.ebooks.conversion.plumber -> Plumber(). Or simply use the main() function from calibre.ebooks.conversion.cli which is what ebook-convert does...
eschwartz is offline   Reply With Quote
Advert
Old 10-24-2019, 01:46 PM   #3
apducer
Junior Member
apducer began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Oct 2019
Device: Kindle
Ok,
My mistake, I can run the calibre CLI but I need to upload it to the server. Am I right? In that case, should I upload the whole calibre source or what?
It would be awesome if you give me some steps on how to do it.

Quote:
Why do you need to "upload the least amount of code"?

The biggest thing you'll be uploading isn't even calibre itself, it is Qt5 WebEngine, used in PDF output, and Qt5 Svg used for image transforms in any conversion, which means you need PyQt5 installed.
Because I am using a free server (in Heroku, it is a python application) with maximum capacity of 500MB. The calibre source code from the tarball provided uses 397.1MB. I want to have space for my code and probably a database. It's like a little to tight.
apducer is offline   Reply With Quote
Reply

Tags
ebook-convert, module, python, server


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre - Python No module named magick BigBird Calibre 7 10-02-2016 05:01 PM
Import module not in bundled Python Toxaris Plugins 11 02-01-2016 01:55 AM
python error: No module named MySQLdb stgabriel Development 1 03-10-2013 02:13 PM
Python error using ebook-convert (Linux) p014k Library Management 4 09-10-2012 10:24 PM
Python 3 - Safe to use/convert to? ahi Workshop 10 09-18-2009 01:56 PM


All times are GMT -4. The time now is 11:38 PM.


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