Workers

The *Worker classes are used when offloading work to a separate thread. They all subclass QObject, and are moved to a QThread instance by moveToThread.

captionWorker details

captionWorker runs on a separate thread to accept input, format captions, and send captions to display and also other endpoints.

There are two important queues, a word_queue and a cap_queue.

Captions has a display/UI component in the main editor that accepts signals from the captionWorker with the caption to display.

display_captions is called every time there is a stroke, and will send any “new text” into the captionWorker.intake while keeping track of positions of text already in the caption.

The text is broken down into “words” and “spaces” and fed into word_queue, then make_caps is called.

make_caps formats everything in the word_queue based on parameters. Formatted caps are sent into the cap_queue.

class captionWorker.captionWorker(*args: Any, **kwargs: Any)

Bases: QObject

Generate captions based on user settings and endpoint parameters for caption display and to send to endpoints.

captionWorker is put into another thread and doesn’t run on the main event thread. Text gets ingested and then sent out as formatted caption lines.

Parameters:
  • roll_caps – boolean, whether to use incremental captions or transcript-like

  • max_length (int, optional) – maximum number of characters for each caption line, suggested value 32, default None

  • remote (str, optional) – name of remote endpoint, can only be one of supported, default None

  • endpoint (str, optional) – URL or local port depending on what kind of remote, may be authentication token, suggested localhost in the case of OBS, default None

  • port (str, optional) – port number to use with endpoint, suggested 4455 for OBS, default None

  • password (str, optional) – password to use along with other fields above, default None

Max_lines:

maximum number of captions lines to display, suggested value 3, default None

capSend

Signal sent with formatted caption line.

alias of str

finished

Signal sent when worker is done.

postMessage

Signal sent with message to display.

alias of str

word_queue

Queue containing text split into word chunks.

next_word

Line number for caption, required for Zoom captions.

cap_line

Buffer for holding caption, when non-rolling

intake(text)

Receive text from main editor and create work chunks for captions :param text: text written into editor :type text: str, required

make_roll_caps()

Ingest word chunks from queue and put lines into caption queue.

send_cap()

Take caption from queue and send to display, and also if endpoint is defined.

clean_and_stop()

Clean up instance and emit signal for finish

send_msteams(cap)

Take caption and send post to Microsoft Teams session

send_zoom(cap)

Take caption and send post to Zoom session

send_obs(cap)

Take caption and send to OBS using obsws_python

Document Worker

documentWorker is used to export the transcript in a separate thread. Each file format is called through save_x.

During the export, as each paragraph is processed, a progress signal is emitted with the paragraph number. This is used for progress bars for long exports. After completing export, the finished signal is sent.

Any new save_x format needs to include code for emitting those two signals.

class documentWorker.documentWorker(*args: Any, **kwargs: Any)

Bases: QObject

Create exported files.

Worker to create export files, with each save_* function creating one specific file format.

Parameters:
  • document (dict) – transcript data of form {"par_number": {paragraph data}, ...}

  • path (str) – path for export file

  • styles – dict of style parameters

  • config – transcript configuration

  • home_dir – transcript home directory

progress

Signal sent progress based on export of paragraph.

alias of int

finished

Signal sent when export is finished.

save_ascii()

Export to formatted ASCII.

save_html()

Export to formatted HTML.

save_odf()

Export to ODF Text Document.

save_plain_ascii()

Export to plain text.

save_rtf()

Export to RTF file with RTF/CRE.

save_srt()

Export to SRT captions.