Skip to main content

Pydantic models and JSON helpers for presentation timing format, shared across projects

Project description

presenter-json

Pydantic models and JSON helpers for presentation timing format — a shared library for the various projects that read and generate these JSON files (training data, playback, benchmarking, …).

The JSON shape resembles the ProPresenter /v1/presentation/{uuid} API response, with extra metadata on presentation.id (audio source, timing method, file version) and per-slide timing lists (trigger time, start time, stop time). Any ProPresenter field not explicitly modelled passes through untouched.

Install

pip install presenter-json

Or with Poetry, as a path/develop dependency from a sibling project:

[tool.poetry.dependencies]
presenter-json = { path = "../presenter-json", develop = true }

Reading a file

from presenter_json import load_presentation, cues, slide_texts

pres = load_presentation("sermon.json")

print(pres.presentation.id.name)
print(slide_texts(pres))            # text of every slide, flattened

for cue in cues(pres):              # sorted playback cues
    print(f"{cue.time:7.3f}  [{cue.group_name}]  {cue.text}")

Generating a file

from presenter_json import (
    new_presentation, add_group, add_slide,
    set_trigger_times, set_metadata, save_presentation,
)

pres = new_presentation(name="My Song", audio_path="audio/my-song.wav")
set_metadata(pres, method="model", method_description="forced alignment", version="1.0")

verse = add_group(pres, "Verse 1")
s1 = add_slide(verse, "First line of the verse")
set_trigger_times(s1, [0.0])
add_slide(verse, "Second line")          # untriggered — no timing written

save_presentation(pres, "my-song.json")

API overview

IO (presenter_json.io)

  • load_presentation(path) / loads_presentation(text)PresentationFile
  • save_presentation(model, path) / dumps_presentation(model)
  • load_raw(path) → unvalidated dict

Reading (presenter_json.helpers)

  • iter_groups, iter_slides, group_name, slide_text, slide_texts, slide_field
  • get_trigger_times / get_start_times / get_stop_times / get_timing
  • detect_timing_key, cues (sorted Cue list)

Generating / mutating

  • new_presentation, add_group, add_slide
  • set_trigger_times / set_start_times / set_stop_times / set_timing, clear_timing
  • set_metadata, from_api_response

Models (presenter_json.models)

  • PresentationFile, Presentation, PresentationId, Group, Slide
  • Constants: METHOD_MANUAL, METHOD_CAPTIONS, METHOD_MODEL, TRIGGER_TIME_KEY, …

Development

poetry install
poetry run pytest

Tests run in GitHub Actions across Python 3.11–3.13 (.github/workflows/ci.yml). Tagging a release (vX.Y.Z) publishes to PyPI via Trusted Publishing (.github/workflows/publish.yml).

All changes go through a branch off main and land via pull request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

presenter_json-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

presenter_json-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file presenter_json-0.1.0.tar.gz.

File metadata

  • Download URL: presenter_json-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for presenter_json-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1da0dc2eb4f9a622c05c5e1079fa6ddaf382325d072e893c2c8442d1e4b9a48b
MD5 a90a27c03156f5b61c6b517f0daf2821
BLAKE2b-256 9101154c010def706e65a1ca9e84b98e72ed8bbdea06e905c1ac44f3e21f4bd1

See more details on using hashes here.

Provenance

The following attestation bundles were made for presenter_json-0.1.0.tar.gz:

Publisher: publish.yml on scaperothian/presenter-json

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file presenter_json-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: presenter_json-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for presenter_json-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 321e8d7ad24afdfc4196ce48db682f49bbf944e47cbb2e9dc85d1b1ed899a3dd
MD5 c6ccdea195d4900cd9c1fdf527bc03d2
BLAKE2b-256 65363dffe77356beb24154984ca21ba2a0c2f050767ec3c81a14625017c9405c

See more details on using hashes here.

Provenance

The following attestation bundles were made for presenter_json-0.1.0-py3-none-any.whl:

Publisher: publish.yml on scaperothian/presenter-json

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page