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.
Installation¶
Module is hosted at GitHub:
and can be installed using PIP:
pip install edeposit.amqp.calibre
API¶
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.Parameters: - 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.
Raises: ValueError
– if invalid input/output format is provided.Create new instance of ConversionRequest(input_format, output_format, b64_data)
- input_format (str) – See
-
class
edeposit.amqp.calibre.structures.
ConversionResponse
[source]¶ Structure is returned as response from
reactToAMQPMessage()
, when the file is converted.Parameters: - type (str) – See
OUTPUT_FORMATS
for details. - b64_data (base64 str) –
base64
encoded converted data. - protocol (str) – Protocol of the conversion.
Create new instance of ConversionResponse(format, b64_data, protocol)
- type (str) – See
Calibre package¶
AMQP communication wrapper for calibre’s ebook-convert
program.
-
edeposit.amqp.calibre.
reactToAMQPMessage
(message, UUID)[source]¶ React to given (AMQP) message. message is usually expected to be
collections.namedtuple()
structure filled with all necessary data.Parameters: - message (*Request class) – only
ConversionRequest
class is supported right now - UUID (str) – unique ID of received message
Returns: response filled with data about conversion and converted file.
Return type: Raises: ValueError
– if bad type of message structure is given.- message (*Request class) – only
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: