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>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Message Notes - saves the sermon notes from email into Google Drive.
|
||||
*
|
||||
* Runs every 10 minutes in the Google account it is installed in (media@waterschurch.org).
|
||||
* When a "Notes/Slides - ..." email arrives with notes attached, it saves the attachment(s)
|
||||
* plus the email text (used to know who is preaching) into the Drive folder "Message Notes".
|
||||
* Google Drive on the ProPresenter Mac syncs that folder, and the Message Notes tool picks
|
||||
* up the newest file from it.
|
||||
*
|
||||
* Setup: paste this into a new project at https://script.google.com (signed in as media@),
|
||||
* save, choose the function "install" and click Run, then click Allow.
|
||||
*/
|
||||
var FOLDER_NAME = 'Message Notes';
|
||||
var QUERY = '(subject:"Notes/Slides" OR to:sermonslides@waterschurch.org) has:attachment newer_than:21d';
|
||||
var KEEP = 300; // how many processed message ids to remember
|
||||
|
||||
function saveSermonNotes() {
|
||||
var props = PropertiesService.getScriptProperties();
|
||||
var done = JSON.parse(props.getProperty('done') || '[]');
|
||||
var folder = getFolder_();
|
||||
var threads = GmailApp.search(QUERY, 0, 30);
|
||||
threads.forEach(function (thread) {
|
||||
thread.getMessages().forEach(function (msg) {
|
||||
var id = msg.getId();
|
||||
if (done.indexOf(id) >= 0) return;
|
||||
var saved = false;
|
||||
msg.getAttachments({includeInlineImages: false}).forEach(function (att) {
|
||||
var name = att.getName();
|
||||
if (!/\.(rtf|docx?)$/i.test(name)) return;
|
||||
replaceFile_(folder, name, att.copyBlob());
|
||||
var base = name.replace(/\.[^.]+$/, '');
|
||||
var info = 'Subject: ' + msg.getSubject() + '\nFrom: ' + msg.getFrom() + '\nDate: ' +
|
||||
msg.getDate().toISOString() + '\n\n' + msg.getPlainBody();
|
||||
replaceFile_(folder, base + '.email.txt', Utilities.newBlob(info, 'text/plain', base + '.email.txt'));
|
||||
saved = true;
|
||||
});
|
||||
done.push(id);
|
||||
});
|
||||
});
|
||||
props.setProperty('done', JSON.stringify(done.slice(-KEEP)));
|
||||
}
|
||||
|
||||
function getFolder_() {
|
||||
var it = DriveApp.getRootFolder().getFoldersByName(FOLDER_NAME);
|
||||
return it.hasNext() ? it.next() : DriveApp.getRootFolder().createFolder(FOLDER_NAME);
|
||||
}
|
||||
|
||||
function replaceFile_(folder, name, blob) {
|
||||
var old = folder.getFilesByName(name);
|
||||
while (old.hasNext()) old.next().setTrashed(true);
|
||||
folder.createFile(blob.setName(name));
|
||||
}
|
||||
|
||||
/** Run once: saves anything recent now and checks every 10 minutes from then on. */
|
||||
function install() {
|
||||
ScriptApp.getProjectTriggers().forEach(function (t) {
|
||||
if (t.getHandlerFunction() === 'saveSermonNotes') ScriptApp.deleteTrigger(t);
|
||||
});
|
||||
ScriptApp.newTrigger('saveSermonNotes').timeBased().everyMinutes(10).create();
|
||||
saveSermonNotes();
|
||||
}
|
||||
Reference in New Issue
Block a user