From c36261caaff9305d256c616edcc9d1fdb51b1b42 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Thu, 3 Nov 2022 18:41:22 -0400 Subject: Change hooks to pass the talk variable --- emacsconf-publish.el | 18 ++++++++++-------- emacsconf-stream.el | 8 ++++---- emacsconf.el | 13 ++++++++----- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/emacsconf-publish.el b/emacsconf-publish.el index 6dcf3f4..3daf7eb 100644 --- a/emacsconf-publish.el +++ b/emacsconf-publish.el @@ -815,13 +815,15 @@ Entries are sorted chronologically, with different tracks interleaved." (with-current-buffer (find-file-noselect emacsconf-org-file) (remove-hook 'org-after-todo-state-change-hook #'emacsconf-publish-backstage-org-after-todo-state-change t))) -(defun emacsconf-publish-backstage-org-after-todo-state-change () - (when (member org-state '("TO_CAPTION")) - (unless (org-entry-get (point) "CAPTIONER") - (org-entry-put (point) "CAPTIONER" - (assoc-default "CUSTOM_ID" (emacsconf-complete-volunteer))))) - (when (member org-state '("TO_ASSIGN" "TO_CAPTION" "TO_STREAM")) - (emacsconf-publish-backstage-index))) +(defun emacsconf-publish-backstage-org-on-state-change (talk) + (save-window-excursion + (emacsconf-with-talk-heading talk + (when (member org-state '("TO_CAPTION")) + (unless (org-entry-get (point) "CAPTIONER") + (org-entry-put (point) "CAPTIONER" + (assoc-default "CUSTOM_ID" (emacsconf-complete-volunteer))))) + (when (member org-state '("TO_ASSIGN" "TO_CAPTION" "TO_STREAM")) + (emacsconf-publish-backstage-index))))) (defun emacsconf-publish-copy-main-files-from-backstage-to-media-root (talk) (interactive (list (emacsconf-complete-talk-info))) @@ -1630,7 +1632,7 @@ ffplay https://live0.emacsconf.org:9001/emacsconf/gen.webm (let ((bbb-filename (expand-file-name (format "bbb-%s.html" (plist-get talk :slug)) emacsconf-publish-current-dir)) (bbb-redirect-url (concat "https://media.emacsconf.org/" emacsconf-year "/current/bbb-" (plist-get talk :slug) ".html")) - (status (emacsconf-bbb-status talk))) + (status (emacsconf-bbb-status (if (boundp 'org-state) (append (list :status org-state) talk) talk)))) (with-temp-file bbb-filename (insert (emacsconf-replace-plist-in-string diff --git a/emacsconf-stream.el b/emacsconf-stream.el index 26586b2..fd1395a 100644 --- a/emacsconf-stream.el +++ b/emacsconf-stream.el @@ -145,15 +145,15 @@ while OTHER-FILENAME will be displayed at other times." (plist-get talk :overlay-url) (plist-get talk :overlay-bottom))))) -(defun emacsconf-stream-update-talk-info-org-after-todo-state-change () +(defun emacsconf-stream-update-talk-info-on-change (talk) "Update talk info." (when (string= org-state "PLAYING") - (emacsconf-stream-set-talk-info (emacsconf-get-talk-info-for-subtree)))) + (emacsconf-stream-set-talk-info talk))) -(defun emacsconf-stream-play-talk-org-after-todo-state-change () +(defun emacsconf-stream-play-talk-on-change (talk) "Play the talk." (when (string= org-state "PLAYING") - (emacsconf-stream-play-video (emacsconf-get-talk-info-for-subtree)))) + (emacsconf-stream-play-video talk))) (defun emacsconf-stream-get-filename (talk) "Return the local filename for the video file for TALK. diff --git a/emacsconf.el b/emacsconf.el index 219c9ed..1b2d81e 100644 --- a/emacsconf.el +++ b/emacsconf.el @@ -1119,16 +1119,19 @@ Filter by TRACK if given. Use INFO as the list of talks." (defvar emacsconf-todo-hooks '( - emacsconf-stream-play-talk-org-after-todo-state-change ;; play the talk + emacsconf-stream-play-talk-on-change ;; play the talk ;; emacsconf-erc-org-after-todo-state-change ;; announce via ERC - ;; emacsconf-publish-backstage-org-after-todo-state-change ;; update the backstage index - emacsconf-stream-update-talk-info-org-after-todo-state-change ;; write to the talk text + emacsconf-publish-bbb-redirect + emacsconf-publish-backstage-org-on-state-change ;; update the backstage index + emacsconf-stream-update-talk-on-change ;; write to the talk text ) - "Functions to run when the todo state changes.") + "Functions to run when the todo state changes. +They will be called with TALK.") (defun emacsconf-org-after-todo-state-change () "Run all the hooks in `emacsconf-todo-hooks'." - (run-hooks 'emacsconf-todo-hooks)) + (let ((talk (emacsconf-get-talk-info-for-subtree))) + (run-hook-with-args 'emacsconf-todo-hooks talk))) (defun emacsconf-broadcast (message) (interactive "MMessage: ") -- cgit v1.2.3