edeposit.amqp.calibre documentation

This module provides wrapper for Calibre, to access it’s conversion functions using AMQP protocol.

Module provides only generic wrapper, not AMQP communication itself - that is handled by Calibredaemon from edeposit.amqp project.



Module is hosted at GitHub:

and can be installed using PIP:

pip install edeposit.amqp.calibre


Data structures

edeposit.amqp.calibre.structures.INPUT_FORMATS = ['cbz', 'cbr', 'cbc', 'chm', 'djvu', 'docx', 'epub', 'fb2', 'html', 'htmlz', 'lit', 'lrf', 'mobi', 'odt', 'pdf', 'prc', 'pdb', 'pml', 'rb', 'rtf', 'snb', 'tcr', 'txt', 'txtz']

List of available input formats.

edeposit.amqp.calibre.structures.OUTPUT_FORMATS = ['azw3', 'epub', 'fb2', 'oeb', 'lit', 'lrf', 'mobi', 'htmlz', 'pdb', 'pml', 'rb', 'pdf', 'rtf', 'snb', 'tcr', 'txt', 'txtz']

List of available output formats.

class edeposit.amqp.calibre.structures.ConversionRequest(input_format, output_format, b64_data)[source]

This structure specifies details of AMQP message, which is passed to reactToAMQPMessage() as request for conversion.

  • input_format (str) – See INPUT_FORMATS for list of valid input formats
  • output_format (str) – See OUTPUT_FORMATS for list of valid output formats.
  • b64_data (base64 str) – base64 encoded file.

ValueError – if invalid input/output format is provided.

class edeposit.amqp.calibre.structures.ConversionResponse[source]

Structure is returned as response from reactToAMQPMessage(), when the file is converted.

  • type (str) – See OUTPUT_FORMATS for details.
  • b64_data (base64 str) – base64 encoded converted data.
  • protocol (str) – Protocol of the conversion.

Calibre package

AMQP communication wrapper for calibre’s ebook-convert program.

edeposit.amqp.calibre.reactToAMQPMessage(message, send_back)[source]

React to given (AMQP) message. message is usually expected to be collections.namedtuple() structure filled with all necessary data.

  • message (*Request class) – only ConversionRequest class is supported right now
  • send_back (fn reference) – Reference to function for responding. This is useful for progress monitoring for example. Function takes one parameter, which may be response structure/namedtuple, or string or whatever would be normally returned.

response filled with data about conversion and converted file.

Return type:



ValueError – if bad type of message structure is given.

Lowlevel access

It is possible to access module directly, by calling python functions to convert data. If you are interested in this way of accessing functuions, please look at:

Indices and tables