core.generator.utils.slide_exporter

File:

EuljiroWorship/core/generator/utils/slide_exporter.py

Author:

Benjamin Jaedon Choi - https://github.com/saintbenjamin

Affiliated Church:

The Eulji-ro Presbyterian Church [대한예수교장로회(통합) 을지로교회]

Address:

The Eulji-ro Presbyterian Church, 24-10, Eulji-ro 20-gil, Jung-gu, Seoul 04549, South Korea

Telephone:

+82-2-2266-3070

E-mail:

euljirochurch [at] G.M.A.I.L. (replace [at] with @ and G.M.A.I.L as you understood.)

License:

MIT License with Attribution Requirement (see LICENSE file for details); Copyright (c) 2025 The Eulji-ro Presbyterian Church.

Slide export pipeline for converting generator slide data into overlay-ready slide blocks.

This module defines the core.generator.utils.slide_exporter.SlideExporter class, which takes structured slide dictionaries produced by the generator UI and transforms them into a flattened sequence of slides suitable for real-time overlay display. The exporter applies style-specific rules such as line segmentation, verse splitting, and style normalization.

class core.generator.utils.slide_exporter.SlideExporter(settings=None)[source]

Bases: object

Convert generator-format slides into overlay-ready slide blocks.

This exporter applies style-specific transformation rules, including automatic line splitting, slide segmentation, and style normalization.

Supported styles and behaviors:

  • lyrics / hymn / anthem

    • Lyrics are split into two-line slides using blank-line boundaries.

    • Hymn slides are exported as lyrics.

    • Anthem slides preserve caption and optional choir name.

  • verse

    • Each (reference, verse) pair is split by character length.

  • respo

    • Each response line is exported as an individual verse-style slide.

  • intro / blank

    • Passed through with minimal transformation.

  • Other styles

    • Passed through unchanged.

Parameters:

settings (dict | None) –

Optional exporter settings.

Supported keys:

  • max_chars (int):

    Maximum characters per text chunk.

max_chars

Maximum characters per exported text chunk.

Type:

int

__init__(settings=None)[source]

Initialize the slide exporter.

See also core.config.constants.MAX_CHARS.

Parameters:

settings (dict | None) – Optional configuration dictionary. If provided, max_chars controls the maximum number of characters allowed per exported text block.

export(raw_slides)[source]

Transform generator slides into a flat list of overlay slides.

The exporter iterates over generator-format slide dictionaries and applies style-dependent rules to produce a sequence of overlay-ready slides.

Parameters:

raw_slides (list[dict]) –

List of slide dictionaries produced by the generator. Each dictionary is expected to include at least:

  • ”style”

  • ”caption”

  • ”headline”

Returns:

A flattened list of slide dictionaries suitable for overlay display.

Return type:

list[dict]

_split_text(text)[source]

Split a text string into smaller chunks by character count.

This helper delegates to core.generator.utils.text_splitter.split_by_length(), using the configured maximum character length for exported slides.

Parameters:

text (str) – Input text to be split.

Returns:

List of text chunks, each within the configured length.

Return type:

list[str]