service.preclass.processors.pptx2pdf module

class service.preclass.processors.pptx2pdf.SERVICE[source]

Bases: object

A service class that handles PowerPoint to PDF conversion tasks.

This service interfaces with MongoDB for job storage and RabbitMQ for job queue management. It uses a Docker container with LibreOffice to perform the actual PPTX to PDF conversion.

static callback(ch, method, properties, body)[source]

Processes a PPTX to PDF conversion job from the queue.

Executes the conversion using a Docker container running LibreOffice, updates the job status in MongoDB, and notifies the parent service upon completion.

Parameters:
  • ch – RabbitMQ channel

  • method – RabbitMQ method frame

  • properties – RabbitMQ properties

  • body – Message body containing the job_id

static launch_worker()[source]

Launches the worker process to consume jobs from the RabbitMQ queue.

Starts a continuous process that listens for conversion jobs and processes them. Can be terminated with CTRL+C.

Raises:

KeyboardInterrupt – When the worker is manually stopped

static trigger(parent_service, lecture_id, parent_job_id)[source]

Triggers a new PPTX to PDF conversion job.

Parameters:
  • parent_service (str) – The name of the parent service that initiated this job

  • lecture_id (ObjectId) – MongoDB ObjectId of the lecture to be processed

  • parent_job_id (ObjectId) – MongoDB ObjectId of the parent job

Returns:

The job_id of the created conversion task

Return type:

str

service.preclass.processors.pptx2pdf.now(tz=None)

Returns new datetime object representing current time local to tz.

tz

Timezone object.

If no tz is specified, uses local timezone.