Files
propresenter-auto-notes/tools/test_restart_link.py
T
christianandClaude Opus 5.5 7122fd144d Message Notes -> ProPresenter tool (v1.1)
Turns the pastor's sermon notes into the message presentation in
ProPresenter's Messages library, built from the series or generic template.

- Notes (RTF/Word) are parsed into title, scriptures (with bold emphasis),
  points, builds, quotes, picture slides and the Sermon in a Sentence;
  team instructions are left off and shown in the summary
- Slides are cloned from the template with fresh ids and the template's own
  formatting; a dependency-free protobuf codec reads/writes .pro files
- Text is checked to fit on the slide and in the stream and LED wall theme
  boxes; long scriptures split at verse numbers, font sizes never change
- Links the presentation into the Planning Center playlist's Message section
  (restarting ProPresenter safely, never while anything is live)
- Picks the newest notes from the email inbox folder (Google Apps Script),
  reads the speaker from the email, and writes the YouTube title and
  description with the Claude API for pasting into Restream
- Offline tests rebuild last Sunday's deck from its notes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 15:58:03 -04:00

47 lines
1.5 KiB
Python

"""One-off check on the ProPresenter Mac: link a message into a playlist via a restart.
Usage (on the ProP Mac):
/usr/bin/python3 test_restart_link.py <message-notes.pyz> "<notes title>" YYYY-MM-DD "<presentation name>"
Refuses to run if anything is on screen. Prints whether the link is in ProPresenter's
playlist file after ProPresenter is running again (and still there 60 s later).
"""
import datetime
import os
import sys
import time
sys.path.insert(0, sys.argv[1])
import app # noqa: E402
import playlist # noqa: E402
import ppctl # noqa: E402
title, day, name = sys.argv[2], sys.argv[3], sys.argv[4]
date = datetime.date(*map(int, day.split("-")))
library = app.find_library()
pro = os.path.join(library, name + ".pro")
assert os.path.isfile(pro), pro
why = ppctl.busy_reason(app.API)
if why:
print("NOT RUN: %s" % why)
sys.exit(1)
def linked():
_, doc = playlist.load(playlist.playlist_file(library))
d, pl = playlist.find_service(doc, title)
if pl is None:
return "no playlist"
h, k = playlist.message_slot(pl)
it = playlist.items_of(pl)[k] if k is not None else None
return playlist.linked_path(it) if it is not None else "no slot"
print("before:", repr(linked()))
t0 = time.time()
print(ppctl.restart_with(lambda: app.link_playlist(library, title, date, name, pro), app.API, print))
print("ProPresenter back after %.0fs, running: %s" % (time.time() - t0, ppctl.app_path(ppctl.pid()) if ppctl.pid() else None))
print("after:", repr(linked()))
time.sleep(60)
print("after 60s:", repr(linked()))