From 6fc5507adc198861342d5986723118860d969372 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Wed, 25 Oct 2023 11:55:28 -0400 Subject: update todo hooks --- emacsconf-erc.el | 28 +++++++++----- emacsconf-stream.el | 106 ++++++++++++++++++++++++++++------------------------ emacsconf.el | 28 +++++++------- 3 files changed, 90 insertions(+), 72 deletions(-) diff --git a/emacsconf-erc.el b/emacsconf-erc.el index 139ae16..bced63d 100644 --- a/emacsconf-erc.el +++ b/emacsconf-erc.el @@ -170,27 +170,34 @@ If MESSAGE is not specified, reset the topic to the template." (plist-get talk :pad-url) (plist-get talk :qa-info) (car (assoc-default (concat "#" (plist-get talk :channel)) emacsconf-topic-templates))))))) + (defun erc-cmd-NOWPLAYING (talk) "Set the channel topics to announce TALK." (interactive (list (emacsconf-complete-talk-info))) - (when (stringp talk) (setq talk (or (emacsconf-find-talk-info talk) (error "Could not find talk %s" talk)))) + (when (stringp talk) + (setq talk (or (emacsconf-find-talk-info talk) (error "Could not find talk %s" talk)))) ;; Announce it in the track's channel (if (emacsconf-erc-recently-announced (format "---- %s:" (plist-get talk :slug))) (message "Recently announced, skipping") (when (plist-get talk :track) (emacsconf-erc-with-channels (list (concat "#" (plist-get talk :channel))) - (erc-cmd-TOPIC (format "%s: %s (%s) pad: %s Q&A: %s | %s" - (plist-get talk :slug) - (plist-get talk :title) - (plist-get talk :speakers) - (plist-get talk :pad-url) - (plist-get talk :qa-info) - (car (assoc-default (concat "#" (plist-get talk :channel)) emacsconf-topic-templates)))) + (erc-cmd-TOPIC + (format + "%s: %s (%s) pad: %s Q&A: %s | %s" + (plist-get talk :slug) + (plist-get talk :title) + (plist-get talk :speakers) + (plist-get talk :pad-url) + (plist-get talk :qa-info) + (car (assoc-default + (concat "#" (plist-get talk :channel)) + emacsconf-topic-templates)))) (erc-send-message (format "---- %s: %s - %s ----" (plist-get talk :slug) (plist-get talk :title) (plist-get talk :speakers-with-pronouns))) - (erc-send-message (concat "Add your notes/questions to the pad: " (plist-get talk :pad-url))) + (erc-send-message + (concat "Add your notes/questions to the pad: " (plist-get talk :pad-url))) (cond ((string-match "live" (or (plist-get talk :q-and-a) "")) (erc-send-message (concat "Live Q&A: " (plist-get talk :bbb-redirect)))) @@ -287,7 +294,8 @@ If MESSAGE is not specified, reset the topic to the template." (defun emacsconf-erc-announce-on-change (talk) "Announce talk." - (let ((func + (let ((emacsconf-publishing-phase 'conference) + (func (pcase org-state ("PLAYING" #'erc-cmd-NOWPLAYING) ("CLOSED_Q" #'erc-cmd-NOWCLOSEDQ) diff --git a/emacsconf-stream.el b/emacsconf-stream.el index da64992..0ac6853 100644 --- a/emacsconf-stream.el +++ b/emacsconf-stream.el @@ -162,20 +162,26 @@ while OTHER-FILENAME will be displayed at other times." (shell-command (concat "firefox " (plist-get talk :qa-slide-url) "&")))) (defun emacsconf-stream-open-qa-windows-on-change (talk) + "Open the QA window(s) for TALK if the track's autopilot is set to 'todo." (interactive (list (emacsconf-complete-talk-info))) - (when (or (not (boundp 'org-state)) (string= org-state "CLOSED_Q")) - (save-window-excursion - (if (or (null (plist-get talk :q-and-a)) - (string-match "Mumble" (plist-get talk :q-and-a))) - (emacsconf-stream-open-in-between-slide talk) - (emacsconf-stream-join-qa talk) - (shell-command "i3-msg 'layout splith'"))))) + (let ((track (emacsconf-get-track (plist-get talk :track)))) + (when (eq (plist-get track :autopilot) 'todo) + (when (or (not (boundp 'org-state)) (string= org-state "CLOSED_Q")) + (save-window-excursion + (if (or (null (plist-get talk :q-and-a)) + (string-match "Mumble" (plist-get talk :q-and-a))) + (emacsconf-stream-open-in-between-slide talk) + (emacsconf-stream-join-qa talk) + (shell-command "i3-msg 'layout splith'"))))))) (defun emacsconf-stream-update-talk-info-on-change (talk) - "Update talk info." + "Update TALK info if the track's autopilot is set to 'todo." (when (string= org-state "PLAYING") - (save-window-excursion - (emacsconf-stream-set-talk-info talk)))) + (let* ((talk (emacsconf-resolve-talk talk)) + (track (emacsconf-get-track (plist-get talk :track)))) + (when (eq (plist-get track :autopilot) 'todo) + (save-window-excursion + (emacsconf-stream-set-talk-info talk)))))) (defun emacsconf-stream-track-ssh (track &rest commands) "SSH to the account for TRACK and run COMMANDS. @@ -207,49 +213,51 @@ especially when two things need to happen close together." (emacsconf-stream-track-ssh talk "nohup" "intro" (plist-get talk :slug))) (defun emacsconf-stream-play-talk-on-change (talk) - "Play the talk." + "Play the talk if the track's autopilot is set to 'todo." (interactive (list (emacsconf-complete-talk-info))) (setq talk (emacsconf-resolve-talk talk)) - (when (or (not (boundp 'org-state)) (string= org-state "PLAYING")) - (if (plist-get talk :stream-files) - (progn + (let ((track (emacsconf-get-track (plist-get talk :track)))) + (when (eq (plist-get track :autopilot) 'todo) + (when (or (not (boundp 'org-state)) (string= org-state "PLAYING")) + (if (plist-get talk :stream-files) + (progn + (emacsconf-stream-track-ssh + talk + "overlay" + (plist-get talk :slug)) + (emacsconf-stream-track-ssh + talk + (append + (list + "nohup" + "mpv") + (split-string-and-unquote (plist-get talk :stream-files)) + (list "&")))) (emacsconf-stream-track-ssh talk - "overlay" - (plist-get talk :slug)) - (emacsconf-stream-track-ssh - talk - (append - (list - "nohup" - "mpv") - (split-string-and-unquote (plist-get talk :stream-files)) - (list "&")))) - (emacsconf-stream-track-ssh - talk - (cons - "nohup" - (cond - ((and - (plist-get talk :recorded-intro) - (plist-get talk :video-file)) ;; recorded intro and recorded talk - (message "should automatically play intro and recording") - (list "play-with-intro" (plist-get talk :slug))) ;; todo deal with stream files - ((and - (plist-get talk :recorded-intro) - (null (plist-get talk :video-file))) ;; recorded intro and live talk; play the intro and join BBB - (message "should automatically play intro; join %s" (plist-get talk :bbb-backstage)) - (list "intro" (plist-get talk :slug))) - ((and - (null (plist-get talk :recorded-intro)) - (plist-get talk :video-file)) ;; live intro and recorded talk, show slide and use Mumble; manually play talk - (message "should show intro slide; play %s afterwards" (plist-get talk :slug)) - (list "intro" (plist-get talk :slug))) - ((and - (null (plist-get talk :recorded-intro)) - (null (plist-get talk :video-file))) ;; live intro and live talk, join the BBB - (message "join %s for live intro and talk" (plist-get talk :bbb-backstage)) - (list "bbb" (plist-get talk :slug))))))))) + (cons + "nohup" + (cond + ((and + (plist-get talk :recorded-intro) + (plist-get talk :video-file)) ;; recorded intro and recorded talk + (message "should automatically play intro and recording") + (list "play-with-intro" (plist-get talk :slug))) ;; todo deal with stream files + ((and + (plist-get talk :recorded-intro) + (null (plist-get talk :video-file))) ;; recorded intro and live talk; play the intro and join BBB + (message "should automatically play intro; join %s" (plist-get talk :bbb-backstage)) + (list "intro" (plist-get talk :slug))) + ((and + (null (plist-get talk :recorded-intro)) + (plist-get talk :video-file)) ;; live intro and recorded talk, show slide and use Mumble; manually play talk + (message "should show intro slide; play %s afterwards" (plist-get talk :slug)) + (list "intro" (plist-get talk :slug))) + ((and + (null (plist-get talk :recorded-intro)) + (null (plist-get talk :video-file))) ;; live intro and live talk, join the BBB + (message "join %s for live intro and talk" (plist-get talk :bbb-backstage)) + (list "bbb" (plist-get talk :slug))))))))))) (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 9d70ad1..5497c05 100644 --- a/emacsconf.el +++ b/emacsconf.el @@ -640,16 +640,17 @@ The subheading should match `emacsconf-abstract-heading-regexp'." (defun emacsconf-add-talk-status (o) + "Add status label and public info." (plist-put o :status-label (or (assoc-default (plist-get o :status) emacsconf-status-types 'string= "") (plist-get o :status))) - (if (or - (member (plist-get o :status) - (split-string "PLAYING CLOSED_Q OPEN_Q UNSTREAMED_Q TO_ARCHIVE TO_EXTRACT TO_FOLLOW_UP DONE")) - (time-less-p (plist-get o :start-time) - (current-time))) - (plist-put o :public t)) + (when (or + (member (plist-get o :status) + (split-string "PLAYING CLOSED_Q OPEN_Q UNSTREAMED_Q TO_ARCHIVE TO_EXTRACT TO_FOLLOW_UP DONE")) + (time-less-p (plist-get o :start-time) + (current-time))) + (plist-put o :public t)) o) (defun emacsconf-talk-live-p (talk) @@ -779,7 +780,9 @@ The subheading should match `emacsconf-abstract-heading-regexp'." (plist-put o :qa-type "none") (plist-put o :qa-link "")) ((string-match "live" (plist-get o :q-and-a)) - (plist-put o :bbb-redirect (format "https://emacsconf.org/current/%s/room/" (plist-get o :slug))) + (plist-put o :bbb-redirect (format "https://media.emacsconf.org/%s/current/bbb-%s.html" + emacsconf-year + (plist-get o :slug))) (plist-put o :qa-info (plist-get o :bbb-redirect)) (plist-put o :qa-url (plist-get o :bbb-redirect)) (plist-put o :qa-backstage-url @@ -1263,7 +1266,7 @@ The subheading should match `emacsconf-abstract-heading-regexp'." :uid 2002 :vnc-display ":5" :vnc-port "5905" - :autopilot t + :autopilot crontab :status "offline") (:name "Development" :color "skyblue" :id "dev" :channel "emacsconf-dev" :watch "https://live.emacsconf.org/2022/watch/dev/" @@ -1278,7 +1281,7 @@ The subheading should match `emacsconf-abstract-heading-regexp'." :start "10:00" :end "17:00" :vnc-display ":6" :vnc-port "5906" - :autopilot t + :autopilot crontab :status "offline"))) (defun emacsconf-get-track (name) @@ -1511,15 +1514,14 @@ Filter by TRACK if given. Use INFO as the list of talks." #'emacsconf-org-after-todo-state-change t))) (defvar emacsconf-todo-hooks - '((emacsconf-stream-play-talk-on-change "gen" "dev") - (emacsconf-stream-open-qa-windows-on-change "gen" "dev") + '(emacsconf-stream-play-talk-on-change + emacsconf-stream-open-qa-windows-on-change emacsconf-erc-announce-on-change ;; announce via ERC emacsconf-publish-bbb-redirect emacsconf-stream-update-talk-info-on-change emacsconf-publish-media-files-on-change - ;; emacsconf-publish-update-talk ;; skipping this for now, I'll do this locally + emacsconf-publish-update-talk emacsconf-publish-backstage-org-on-state-change ;; update the backstage index - ;; write to the talk text ) "Functions to run when the todo state changes. They will be called with TALK.") -- cgit v1.2.3