summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-11-03 18:41:22 -0400
committerSacha Chua <sacha@sachachua.com>2022-11-03 18:41:22 -0400
commitc36261caaff9305d256c616edcc9d1fdb51b1b42 (patch)
treedb26ab46121d26442002dd8d4b190d8a8393dae9
parent3cce90093797c7524cecff94df35b4b8253f91fa (diff)
downloademacsconf-el-c36261caaff9305d256c616edcc9d1fdb51b1b42.tar.xz
emacsconf-el-c36261caaff9305d256c616edcc9d1fdb51b1b42.zip
Change hooks to pass the talk variable
-rw-r--r--emacsconf-publish.el18
-rw-r--r--emacsconf-stream.el8
-rw-r--r--emacsconf.el13
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: ")