;;; emacsconf-pad.el --- Working with Etherpad -*- lexical-binding: t; -*- ;; Copyright (C) 2022 Sacha Chua ;; Author: Sacha Chua ;; Keywords: convenience ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;; Prepopulate the Etherpad: emacsconf-pad-prepopulate-all-talks ;; ;; Prepopulate shift hyperlists: emacsconf-pad-prepopulate-hyperlists ;; Prepopulate checkins: emacsconf-pad-prepopulate-checkins (defcustom emacsconf-pad-base "https://pad.emacsconf.org/" "Base URL for the Etherpad. Include trailing slash. Use \"wikimedia\" to use etherpad.wikimedia.org instead." :group 'emacsconf :type 'string) (defcustom emacsconf-pad-api-key nil "API key for authenticating against the Etherpad. You can find it in $ETHERPAD_PATH/APIKEY.txt" :group 'emacsconf :type 'string) (defcustom emacsconf-pad-slug-base (concat emacsconf-year) "Base for the pad IDs" :group 'emacsconf :type 'string) (defcustom emacsconf-pad-directory "" "Set to /p/ if you don't have friendly URLs set up in the proxy." :group 'emacsconf :type 'string) ;;; Code: (defun emacsconf-pad-delete-pad (pad-id) (interactive "MPad ID: ") (switch-to-buffer (url-retrieve-synchronously (format "%sapi/1/deletePad?apikey=%s&padID=%s" emacsconf-pad-base emacsconf-pad-api-key pad-id)))) (defun emacsconf-pad-json-request (url &optional display-result) (with-current-buffer (url-retrieve-synchronously url) (goto-char (point-min)) (re-search-forward "^$") (let ((result (json-read))) (when display-result (prin1 result)) (kill-buffer) result))) (defun emacsconf-pad-create-pad (pad-id) (interactive "MPad ID: ") (emacsconf-pad-json-request (format "%sapi/1/createPad?apikey=%s&padID=%s" emacsconf-pad-base (url-hexify-string emacsconf-pad-api-key) (url-hexify-string pad-id)) (called-interactively-p 'any))) (defun emacsconf-pad-delete-pad (pad-id) (interactive "MPad ID: ") (emacsconf-pad-json-request (format "%sapi/1/deletePad?apikey=%s&padID=%s" emacsconf-pad-base (url-hexify-string emacsconf-pad-api-key) (url-hexify-string pad-id)) (called-interactively-p 'any))) (defun emacsconf-pad-get-text (pad-id) (interactive "MPad ID: ") (emacsconf-pad-json-request (format "%sapi/1/getText?apikey=%s&padID=%s" emacsconf-pad-base (url-hexify-string emacsconf-pad-api-key) (url-hexify-string pad-id)) (called-interactively-p 'any))) (defun emacsconf-pad-set-text (pad-id text) (interactive "MPad ID: \nMText: ") (emacsconf-pad-json-request (format "%sapi/1/setText?apikey=%s&padID=%s&text=%s" emacsconf-pad-base (url-hexify-string emacsconf-pad-api-key) (url-hexify-string pad-id) (url-hexify-string text)) (called-interactively-p 'any))) (defun emacsconf-pad-append-text (pad-id text) (interactive "MPad ID: \nMText: ") (emacsconf-pad-json-request (format "%sapi/1.2.13/appendText?apikey=%s&padID=%s&text=%s" emacsconf-pad-base (url-hexify-string emacsconf-pad-api-key) (url-hexify-string pad-id) (url-hexify-string text)) (called-interactively-p 'any))) (defun emacsconf-pad-get-html (pad-id) (interactive "MPad ID: ") (assoc-default 'html (assoc-default 'data (emacsconf-pad-json-request (format "%sapi/1/getHTML?apikey=%s&padID=%s" emacsconf-pad-base (url-hexify-string emacsconf-pad-api-key) (url-hexify-string pad-id)) (called-interactively-p 'any))))) (defun emacsconf-pad-set-html (pad-id html) "Set PAD-ID contents to the given HTML." (interactive "MPad ID: \nMHTML: ") (let ((url-request-data (concat "html=" (url-hexify-string html))) (url-request-method "POST") (url-request-extra-headers '(("Content-Type" . "application/x-www-form-urlencoded")))) (emacsconf-pad-json-request (format "%sapi/1/setHTML?apikey=%s&padID=%s" emacsconf-pad-base (url-hexify-string emacsconf-pad-api-key) (url-hexify-string pad-id)) (called-interactively-p 'any)))) ;; (emacsconf-pad-append-text "emacsconf-2022-journalism" "Hello again") ;; (emacsconf-pad-get-html "emacsconf-2022-journalism") ;; (emacsconf-pad-set-html "emacsconf-2022-journalism" "
Hello world
") (defun emacsconf-pad-get-last-edited (pad-id) (interactive "MPad ID: ") (emacsconf-pad-json-request (format "%sapi/1/getLastEdited?apikey=%s&padID=%s" emacsconf-pad-base (url-hexify-string emacsconf-pad-api-key) (url-hexify-string pad-id)) (called-interactively-p 'any))) (defun emacsconf-pad-id (o) (concat emacsconf-pad-slug-base "-" (plist-get o :slug))) (defun emacsconf-pad-url (o) (if (string= emacsconf-pad-base "wikimedia") (format "https://etherpad.wikimedia.org/p/emacsconf-%s-%s" emacsconf-year (plist-get o :slug)) (concat emacsconf-pad-base emacsconf-pad-directory (emacsconf-pad-id o)))) (defvar emacsconf-pad-number-of-next-talks 3 "Integer limiting the number of next talks to link to from the pad.") (defun emacsconf-pad-initial-content (o) (emacsconf-replace-plist-in-string (append (list :base-url emacsconf-base-url :channel (concat "emacsconf-" (plist-get (emacsconf-get-track (plist-get o :track)) :id)) :bbb-info (pcase (plist-get o :q-and-a) ('nil "
Q&A: none
") ((rx "live") (format "
Q&A room: %s
" (plist-get o :bbb-redirect))) ((rx "pad") (format "
Q&A: Etherpad
")) ((rx "irc") (format "
Q&A: IRC (%s)
" (plist-get o :webchat-url))) ((rx "after") (format "
Q&A: after the event
")) (_ "
Q&A: none
")) :next-talk-list (if (plist-get o :next-talks) (concat "
Next talks:\n
    " (mapconcat (lambda (o) (format "
  • %s: %s %s
  • " (plist-get o :track) (plist-get o :title) (emacsconf-pad-url o))) (plist-get o :next-talks) "\n") "
") "") :track-id (plist-get (emacsconf-get-track (plist-get o :track)) :id) :watch (concat emacsconf-base-url emacsconf-year "/watch/" (plist-get (emacsconf-get-track (plist-get o :track)) :id) "/") :talks (concat emacsconf-base-url emacsconf-year "/talks/") :notes (string-join (make-list 6 "
  • ")) :questions (string-join (make-list 6 "
  • Q:
    • A:
  • ")) :conf-pad-url (concat "https://pad.emacsconf.org/" emacsconf-year) :irc-nick-details (if (plist-get o :irc) (concat "Speaker nick: " (plist-get o :irc) " - ") "") :irc-url (concat "" )) o) "
    All talks: ${talks}
    ${title}
    ${base-url}${url} - ${speakers} - Track: ${track}
    Watch/participate: ${watch}
    ${bbb-info}
    IRC: ${irc-nick-details} https://chat.emacsconf.org/#/connect?join=emacsconf,emacsconf-${track-id} or #emacsconf-${track-id} on libera.chat network
    Guidelines for conduct: ${base-url}conduct
    See end of file for license (CC Attribution-ShareAlike 4.0 + GPLv3 or later)
    ----------------------------------------------------------------
    Notes, discussions, links, feedback:
      ${notes}
    ----------------------------------------------------------------
    Questions and answers go here:
      ${questions}
    ----------------------------------------------------------------
    ${next-talk-list}
    Questions/comments related to EmacsConf ${year} as a whole? ${conf-pad-url}
    ----------------------------------------------------------------
    This pad will be archived at ${base-url}${url} after the conference.
    Except where otherwise noted, the material on the EmacsConf pad are dual-licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International Public License; and the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) an later version. Copies of these two licenses are included in the EmacsConf wiki repository, in the COPYING.GPL and COPYING.CC-BY-SA files (https://emacsconf.org/COPYING/)
    By contributing to this pad, you agree to make your contributions available under the above licenses. You are also promising that you are the author of your changes, or that you copied them from a work in the public domain or a work released under a free license that is compatible with the above two licenses. DO NOT SUBMIT COPYRIGHTED WORK WITHOUT PERMISSION.
    ")) (defun emacsconf-pad-prepopulate-main-pad () (interactive) (let ((pad-id emacsconf-year)) (emacsconf-pad-create-pad pad-id) (emacsconf-pad-set-html pad-id (emacsconf-replace-plist-in-string (list :base-url emacsconf-base-url :notes (string-join (make-list 6 "
  • ")) :questions (string-join (make-list 6 "
  • Q:
    • A:
  • ")) :year emacsconf-year) "
    EmacsConf ${year} - this pad is for general conference-related questions and feedback
    All talks: ${base-url}${year}/talks - see specific talk pages for links to their Etherpads
    Conference hallway IRC channel: https://chat.emacsconf.org/#/connect?join=emacsconf or #emacsconf on libera.chat network
    Organizers channel: https://chat.emacsconf.org/#/connect?join=emacsconf,emacsconf-org or #emacsconf-org on libera.chat network
    Guidelines for conduct: ${base-url}conduct
    See end of file for license (CC Attribution-ShareAlike 4.0 + GPLv3 or later)
    ----------------------------------------------------------------
    Notes, discussions, links, feedback:
      ${notes}
    ----------------------------------------------------------------
    Questions and answers go here:
      ${questions}
    ----------------------------------------------------------------
    This pad will be archived at ${base-url}${url} after the conference.
    Except where otherwise noted, the material on the EmacsConf pad are dual-licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International Public License; and the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) an later version. Copies of these two licenses are included in the EmacsConf wiki repository, in the COPYING.GPL and COPYING.CC-BY-SA files (https://emacsconf.org/COPYING/)
    By contributing to this pad, you agree to make your contributions available under the above licenses. You are also promising that you are the author of your changes, or that you copied them from a work in the public domain or a work released under a free license that is compatible with the above two licenses. DO NOT SUBMIT COPYRIGHTED WORK WITHOUT PERMISSION.
    ")))) (defvar emacsconf-pad-force-all nil "Set to t to clear everything.") (defun emacsconf-pad-prepopulate-talk-pad (o) "Fill in the pad for O." (interactive (list (let ((info (emacsconf-include-next-talks (emacsconf-get-talk-info) emacsconf-pad-number-of-next-talks))) (emacsconf-complete-talk-info info)))) (let ((pad-id (emacsconf-pad-id o))) (emacsconf-pad-create-pad pad-id) (when (or emacsconf-pad-force-all (not (emacsconf-pad-modified-p pad-id)) (progn (browse-url (emacsconf-pad-url o)) (y-or-n-p (format "%s might have been modified. Reset? " (plist-get o :slug))))) (emacsconf-pad-set-html pad-id (emacsconf-pad-initial-content o)) (save-window-excursion (emacsconf-with-talk-heading (plist-get o :slug) (let-alist (emacsconf-pad-get-last-edited pad-id) (org-entry-put (point) "PAD_RESET" (number-to-string .data.lastEdited)))))))) (defun emacsconf-pad-prepopulate-all-talks (&optional info) (interactive) (mapc #'emacsconf-pad-prepopulate-talk-pad (emacsconf-include-next-talks (or info (emacsconf-get-talk-info)) emacsconf-pad-number-of-next-talks))) (defun emacsconf-pad-export-initial-content (o file) (interactive (list (let ((info (emacsconf-include-next-talks (emacsconf-get-talk-info) emacsconf-pad-number-of-next-talks))) (emacsconf-complete-talk-info info)) (read-file-name "Output file: "))) (when (file-directory-p file) (setq file (expand-file-name (concat (plist-get o :slug) ".html") file))) (with-temp-file file (insert (emacsconf-pad-initial-content o)))) (defun emacsconf-pad-export-initial-content-for-all-talks (dir &optional info) (interactive (list (read-file-name "Output directory: " nil nil nil nil 'file-directory-p))) (setq info (emacsconf-include-next-talks (or info (emacsconf-get-talk-info)) emacsconf-pad-number-of-next-talks)) (mapcar (lambda (o) (emacsconf-pad-export-initial-content o dir)) (emacsconf-active-talks (emacsconf-filter-talks info)))) (defmacro emacsconf-pad-with-heading (pad-id &rest body) (declare (indent 1) (debug t)) `(progn (with-current-buffer (find-file emacsconf-org-file) (goto-char (org-find-property "SLUG" (if (string-match "^[0-9]+-\\(.*\\)$" ,pad-id) (match-string 1 ,pad-id) "meta"))) ,@body))) (defun emacsconf-pad-modified-p (pad-id) (save-window-excursion (save-excursion (let ((cached-last-modified (emacsconf-pad-with-heading pad-id (org-entry-get (point) "PAD_RESET"))) (result (emacsconf-pad-get-last-edited pad-id))) (let-alist result (and cached-last-modified (not (string= cached-last-modified (number-to-string .data.lastEdited))))))))) ;;; Hyperlists (defun emacsconf-pad-export-initial-content-for-hyperlists (dir &optional info) (interactive (list (read-file-name "Output directory: " nil nil nil nil 'file-directory-p))) (setq info (emacsconf-publish-prepare-for-display (emacsconf-get-talk-info))) (unless (file-directory-p dir) (make-directory dir)) (mapc (lambda (shift) (with-temp-file (expand-file-name (concat (plist-get shift :id) ".html") dir) (insert (emacsconf-pad-format-shift-hyperlist (append (list :year emacsconf-year :track-id (plist-get (emacsconf-get-track (plist-get shift :track)) :id))) shift info)))) emacsconf-shifts)) ;; (emacsconf-pad-export-initial-content-for-hyperlists "/ssh:media:~/backstage/hyperlists") (defun emacsconf-pad-format-shift-hyperlist (shift info) (let* ((track (emacsconf-get-track (plist-get shift :track))) (prefixed (list :start (plist-get shift :start) :end (plist-get shift :end) :base-url emacsconf-base-url :year emacsconf-year :ssh-port "46668" :vnc-port (plist-get track :vnc-port) :host (format "%s" (emacsconf-surround "HOST-" (plist-get shift :host) "" "HOST")) :stream (format "%s" (emacsconf-surround "STREAM-" (plist-get shift :streamer) "" "STREAM")) :irc-volunteer (format "%s" (emacsconf-surround "IRC-" (plist-get shift :irc) "" "IRC")) :track-id (plist-get track :id) :conf-id emacsconf-id :checkin (format "%s" (emacsconf-surround "CHECKIN-" (plist-get shift :checkin) "" "CHECKIN")) :pad (format "%s" (emacsconf-surround "PAD-" (plist-get shift :pad) "" "PAD")) :coord (format "%s" (emacsconf-surround "COORD-" (plist-get shift :coord) "" "COORD")) :checkin-pad (concat emacsconf-pad-base "checkin-" (downcase (format-time-string "%a" (date-to-time (plist-get shift :start))))))) (shift-talks (mapcar (lambda (o) (append prefixed o)) (seq-filter (lambda (talk) (string= (plist-get talk :track) (plist-get shift :track))) (emacsconf-filter-talks-by-time (plist-get shift :start) (plist-get shift :end) info))))) (concat (emacsconf-replace-plist-in-string (append (list :index (concat emacsconf-pad-base "private-" emacsconf-private-pad-prefix "-" emacsconf-year) :year emacsconf-year) shift) (concat "Back to ${index}
    In case of ...: https://pad.emacsconf.org/exceptions
    " "

    " (plist-get shift :id) "

    " "

    Host: ${host}, Streamer: ${streamer}, IRC: ${irc}, Pad: ${pad}, Check-in: ${checkin}, Coord: ${coord}

    ")) (emacsconf-replace-plist-in-string prefixed (concat "

    Ctrl-5 is the shortcut for striking through on Etherpad.

    Don't use this for notes since it gets overwritten.

    Setup " "Talks " "Teardown ")) ))) (defun emacsconf-pad-format-checkin-hyperlist (talk) (emacsconf-replace-plist-in-string (append (list :speakers (concat "" (plist-get talk :speakers) (emacsconf-surround " (" (plist-get talk :irc) ")" "") "") :time (format-time-string "%-l:%M %p" (plist-get talk :checkin-time) emacsconf-timezone) :live (format-time-string "%-l:%M %p" (plist-get talk :live-time) emacsconf-timezone) :start (format-time-string "%-l:%M %p" (plist-get talk :start-time) emacsconf-timezone) :bbb-checklist (emacsconf-replace-plist-in-string (list :backstage-url-with-password (emacsconf-backstage-url (plist-get talk :bbb-backstage)) :backstage-user emacsconf-backstage-user :pronunciation (concat (emacsconf-surround "" (plist-get talk :pronunciation) " or listen to " "Refer to ") (format "%s%s/backstage/%s--intro.webm" emacsconf-media-base-url emacsconf-year (plist-get talk :file-prefix))) :backstage-password emacsconf-backstage-password :backstage-url (plist-get talk :bbb-backstage) :live (emacsconf-timezone-strings-combined (plist-get talk :live-time) (plist-get talk :timezone) "%-l:%M %p")) "")) talk) (if (plist-get talk :video-file) (pcase (or (plist-get talk :q-and-a) "") ((rx "live") "
  • [ ] ${time} Q&A: BBB: ${speakers} should be checked into ${bbb-backstage} and set as moderator(s) to go live at ${live} ${absolute-url} ${bbb-checklist}
  • ") ((or (rx "IRC") (rx "pad")) "
  • [ ] ${time} Q&A: IRC/pad: ${speakers} should be in #${channel} to go live at ${live} ${absolute-url}
  • ") ((rx "Mumble") "
  • [ ] ${time} Q&A: Mumble: ${speakers} should be in Mumble to go live at ${live} ${absolute-url}
  • ") (_ "")) "
  • [ ] ${time} LIVE: ${speakers} should be checked into ${bbb-backstage} and set as moderator(s) for ${absolute-url} to go live at ${start}${bbb-checklist}
  • "))) (defun emacsconf-pad-prepopulate-checkins (&optional info) (interactive) (setq info (or info (seq-filter (lambda (o) (plist-get o :email)) (emacsconf-publish-prepare-for-display (emacsconf-get-talk-info))))) (mapc (lambda (day) (let ((pad-id (concat "checkin-" (downcase (format-time-string "%a" (plist-get (cadr day) :checkin-time)))))) (emacsconf-pad-create-pad pad-id) (emacsconf-pad-set-html pad-id (replace-regexp-in-string "${checkin}: " "" (concat (car day) "

    If anyone's still missing by the specified time, please let us know in #emacsconf-org so we can call them.

    " ""))))) (seq-group-by (lambda (talk) (format-time-string "%A, %b %-e, %Y" (plist-get talk :checkin-time))) info))) (defun emacsconf-pad-prepopulate-index () (interactive) (let ((id (format "private-%s-%s" emacsconf-private-pad-prefix emacsconf-year))) (emacsconf-pad-create-pad id) (emacsconf-pad-set-html id (emacsconf-replace-plist-in-string (list :base-url emacsconf-base-url :year emacsconf-year :checkin-list (mapconcat (lambda (day) (concat "
  • " emacsconf-pad-base "checkin-" (downcase (format-time-string "%a" (plist-get (cadr day) :checkin-time))) "
  • ")) (seq-group-by (lambda (talk) (format-time-string "%A, %b %-e, %Y" (plist-get talk :checkin-time))) (seq-filter (lambda (o) (plist-get o :checkin-time)) (emacsconf-publish-prepare-for-display (emacsconf-get-talk-info)))) "") :shift-list (mapconcat (lambda (shift) (format "
  • %sprivate-%s-%s-%s
  • " emacsconf-pad-base emacsconf-private-pad-prefix emacsconf-year (plist-get shift :id))) emacsconf-shifts "") :host-list (mapconcat (lambda (shift) (format "
  • %shost-%s
  • " emacsconf-pad-base (plist-get shift :id))) emacsconf-shifts "") ) "

    Things to do in case of... https://pad.emacsconf.org/exceptions

    Checkin:
      ${checkin-list}
    Host-focused hyperlists:
      ${host-list}
    Combined shift info:
      ${shift-list}
    ")))) (defun emacsconf-pad-prepopulate-shift-hyperlist (shift &optional info) (interactive (list (completing-read "Shift: " (mapcar (lambda (o) (plist-get o :id)) emacsconf-shifts)))) (when (stringp shift) (setq shift (seq-find (lambda (o) (string= (plist-get o :id) shift)) emacsconf-shifts))) (unless info (setq info (emacsconf-publish-prepare-for-display (emacsconf-get-talk-info)))) (let ((info (emacsconf-publish-prepare-for-display (emacsconf-get-talk-info))) (pad-id (format "private-%s-%s-%s" emacsconf-private-pad-prefix emacsconf-year (plist-get shift :id)))) (emacsconf-pad-create-pad pad-id) (emacsconf-pad-set-html pad-id (emacsconf-pad-format-shift-hyperlist shift info)))) (defun emacsconf-pad-prepopulate-host-hyperlists () (interactive) (mapc #'emacsconf-pad-prepopulate-shift-hyperlist-host emacsconf-shifts)) (defun emacsconf-pad-prepopulate-shift-hyperlist-host (shift &optional info) (interactive (list (completing-read "Shift: " (mapcar (lambda (o) (plist-get o :id)) emacsconf-shifts)))) (when (stringp shift) (setq shift (seq-find (lambda (o) (string= (plist-get o :id) shift)) emacsconf-shifts))) (unless info (setq info (emacsconf-publish-prepare-for-display (emacsconf-get-talk-info)))) (let ((info (emacsconf-publish-prepare-for-display (emacsconf-get-talk-info)))) (let* ((pad-id (format "host-%s" (plist-get shift :id))) (shift-talks (seq-filter (lambda (talk) (string= (plist-get talk :track) (plist-get shift :track))) (emacsconf-filter-talks-by-time (plist-get shift :start) (plist-get shift :end) info)))) (emacsconf-pad-create-pad pad-id) (emacsconf-pad-set-html pad-id (concat "

    Ctrl-5 is the shortcut for striking through on Etherpad.

    Don't use this for notes since it gets overwritten.

    Setup: " "Talks "))))) (defun emacsconf-pad-prepopulate-shift-hyperlists () (interactive) (let ((info (emacsconf-publish-prepare-for-display (emacsconf-get-talk-info)))) (mapc (lambda (shift) (emacsconf-pad-prepopulate-shift-hyperlist shift info)) emacsconf-shifts))) (defun emacsconf-pad-prepopulate-hyperlists () (interactive) (emacsconf-pad-prepopulate-shift-hyperlists) (emacsconf-pad-prepopulate-checkins) (emacsconf-pad-prepopulate-host-hyperlists)) (defun emacsconf-pad-expand-intro (talk) "Make an intro for TALK." (cond ((null (plist-get talk :speakers)) (format "Next, we have \"%s\"." (plist-get talk :title))) ((plist-get talk :intro-note) (plist-get talk :intro-note)) (t (let ((pronoun (pcase (plist-get talk :pronouns) ((rx "she") "She") ((rx "\"ou\"" "Ou")) ((or 'nil "nil") nil) ((or (rx string-start "he") (rx "him")) "He") ((rx "they") "They") (_ (plist-get talk :pronouns))))) (format "Next, we have \"%s\",\nby %s%s.%s" (plist-get talk :title) (replace-regexp-in-string ", \\([^,]+\\)$" ", and \\1" (plist-get talk :speakers)) (emacsconf-surround " (" (plist-get talk :pronunciation) ")" "") (pcase (plist-get talk :q-and-a) ((or 'nil "") "") ((rx "after") "\nYou can ask questions via Etherpad and IRC.\nWe'll send them to the speaker,\nand we'll post the answers on the talk page afterwards.") ((rx "live") (if pronoun (format "\n%s will answer questions via web conference.\nYou can join using the URL from the talk page\nor ask questions through Etherpad or IRC." pronoun) "\nYou can ask questions via web conference by joining from the talk page\nor ask questions through Etherpad or IRC.")) ((rx "pad") (if pronoun (format "\n%s will answer questions via Etherpad." pronoun) "\nYou can ask questions via Etherpad.")) ((rx "IRC") (if pronoun (format "\n%s will answer questions via IRC in the #%s channel." pronoun (plist-get talk :channel)) (format "\nYou can ask questions via IRC in the #%s channel." (plist-get talk :channel)))))))))) ;; Related: emacsconf-talk-hyperlist (defun emacsconf-pad-talk-hyperlist (talk &optional do-insert) (interactive (list (emacsconf-complete-talk-info) t)) (let* ((track-id (plist-get (emacsconf-get-track talk) :id)) (next-talk (car (plist-get talk :next-talks))) (modified-talk (apply #'append (list :year emacsconf-year :track-id track-id :intro-note (emacsconf-pad-expand-intro talk) :media-base emacsconf-media-base-url :mumble (concat emacsconf-id "-" track-id) :next-talk-in-5 (if next-talk (format-time-string "%-l:%M %p" (time-subtract (plist-get next-talk :start-time) (seconds-to-time 300)) emacsconf-timezone) "") :next-talk-in-1 (if next-talk (format-time-string "%-l:%M %p" (time-subtract (plist-get next-talk :start-time) (seconds-to-time 60)) emacsconf-timezone) "") :qa-start (format-time-string "%-l:%M %p" (plist-get talk :qa-time) emacsconf-timezone) :qa-end (if next-talk (format-time-string "%-l:%M %p" (plist-get next-talk :start-time)) "end of shift") :ssh "ssh orga@res.emacsconf.org -p 46668 " :ssh-track (format "ssh %s-%s@res.emacsconf.org -p 46668 " emacsconf-id track-id) :ssh-audio (format "ex: ssh emacsconf-%s@res.emacsconf.org -p 46668 \"qa-vol 85%%\" (or qa-louder, qa-quieter, mum-vol, mum-louder, mum-quieter)" track-id)) talk (mapcar (lambda (status) (list (intern (concat ":ssh-" (replace-regexp-in-string "_" "" (downcase status)))) (format "ssh orga@res.emacsconf.org -p 46668 \"talk %s %s\"" (plist-get talk :slug) status))) '("PLAYING" "OPEN_Q" "CLOSED_Q")))) result) (unless (plist-get talk :recorded-intro) (error "Unplanned scenario for %s - no recorded intro?" (plist-get talk :slug))) (setq result (emacsconf-replace-plist-in-string modified-talk (format "
  • %s %s (intro: %s, talk: %s, Q&A: %s) %s %s
      %s
    \n
  • " (format-time-string "%-l:%M %p" (plist-get talk :start-time) emacsconf-timezone) (plist-get talk :slug) (if (plist-get talk :recorded-intro) "recorded" "live") (if (plist-get talk :video-file) "recorded" "live") (or (plist-get talk :q-and-a) "none") (plist-get talk :title) (plist-get talk :absolute-url) (plist-get talk :absolute-url) (concat (emacsconf-surround "
  • " (plist-get talk :hyperlist-note) "
  • " "") "
  • Recorded intro: ${media-base}${year}/backstage/${file-prefix}--intro.webm" (if (plist-get talk :video-file) "
  • [ ] [? stream didn't auto-play] ${stream}: handle-session ${slug}; if that doesn't work, play ${slug}; if that still doesn't work, track-mpv ~/current/cache/${conf-id}-${year}-${slug}*--intro.webm and track-mpv ~/current/cache/${conf-id}-${year}-${slug}*--main.webm
  • " (concat "
  • Live talk:
  • ")) (pcase (or (plist-get talk :q-and-a) "") ((rx "live") (concat "
  • Live Q&A start ${qa-start}, on stream until ${qa-end}
    • [ ] ${host}: Join the Q&A room at ${bbb-backstage} and open the pad at ${pad-url}; optionally open IRC for ${channel} (${webchat-url})
    • [ ] [? speaker missing?] ${host}: Let #emacsconf-org know so that we can text or call the speaker
    • [ ] [? stream didn't auto-join?] ${stream}: bbb ${slug}
    • [ ] ${stream}: Give the host the go-ahead via Mumble or #emacsconf-org
    • [ ] ${host}: Start recording and read questions
    • [ ] ${stream}: Adjust the audio levels as needed: ${ssh-audio}
    • " (if emacsconf-qa-start-open "" "
    • [ ] ${host}: Decide when to open the Q&A and let ${stream} know
    • [ ] ${stream}: Update the task status (no visible changes): ${ssh-openq}
    • ") "
    • [ ] ${stream}: Confirm BBB redirect at ${bbb-redirect} goes to BBB room, let host know
    • [ ] ${host}: Announce that people can join using the URL on the talk page or ask questions on the pad or IRC channel
    • ${next-talk-in-5} [? Open Q&A is still going on and it's about five minutes before the next talk]
      • [ ] ${host}: Let the speaker know about the time and that the Q&A can continue off-stream if people want to join
    • ${next-talk-in-1} [? Open Q&A is still going on and it's about a minute before the next talk]
      • [ ] ${host}: Announce that the Q&A will continue if people want to join the BBB room from the talk page, and the stream will now move to the next talk
    • [? Q&A is done early]
      • ${stream}: OR:
        • start emacs and use M-x emacsconf-stream-display-clock-and-countdown. time and message are optional
        • display the in-between slide for the next talk
  • ")) ((rx "irc") "
  • [ ] ${stream}: Update the task status, which should open the pad and IRC; arrange windows: ${ssh-closedq}
  • [ ] ${stream}: Update the task status (no visible changes): ${ssh-openq}
  • [ ] ${host}: Announce that people can ask questions in the ${channel} IRC channel.
  • ") ((rx "Mumble") "
  • [ ] ${stream}: Bring the speaker's Mumble login over to the ${channel} channel in Mumble. Confirm that Mumble is audible and adjust audio as needed: ssh emacsconf-${track-id}@res.emacsconf.org -p 46668 \"mum-vol 85%%\" (or mum-louder, mum-quieter)
  • [ ] ${stream}: Mark the Q&A as closed: ${ssh-closedq} . This should display the QA slide (backup: ${ssh-track} and run firefox ${qa-slide-url} &)
  • [ ] ${stream}: Update the task status (no visible changes): ${ssh-openq}
  • [ ] ${host}: Announce that people can ask questions in the pad or on the ${channel} IRC channel.
  • ") ((rx "after") "
  • [ ] ${stream}: Update the task status: ${ssh-closedq} # this should open the pad and IRC; arrange the windows
    • Backup link to pad: ${pad-url}
    • Backup link to #${channel}: ${webchat-url}
  • [ ] ${host}: Announce that people can ask questions in the pad or on the ${channel} IRC channel, and that the speaker will follow up later.
  • [ ] ${stream}: Update the task status: ${ssh-openq} # this should not make any visible changes, just update the task status
  • " ) ((rx "pad") "
  • [ ] [? pad didn't auto-open] ${stream}: ${pad-url}
  • ") (_ "
  • [ ] ${stream}: Open the IRC channel (${channel}) and the pad, and arrange the windows: ${ssh-closedq}
  • ")))))) (if do-insert (insert result)) result)) (defun emacsconf-pad-prepopulate-intros () (interactive) (emacsconf-pad-create-pad "intros") (emacsconf-pad-set-html "intros" (concat "

    https://media.emacsconf.org/" emacsconf-year "/backstage/

    This page is for easy reference and recording. Please make sure any changes here are reflected in the INTRO_NOTE property of the talk. "))) (defun emacsconf-pad-backup-talk (talk) (interactive (list (emacsconf-complete-talk-info))) (with-temp-file (expand-file-name (concat (plist-get talk :file-prefix) "--pad.html") emacsconf-cache-dir) (insert (emacsconf-pad-get-html (emacsconf-pad-id talk)))) (call-process "pandoc" nil nil nil "-o" (expand-file-name (concat (plist-get talk :file-prefix) "--pad.md") emacsconf-cache-dir) (expand-file-name (concat (plist-get talk :file-prefix) "--pad.html") emacsconf-cache-dir))) (defun emacsconf-pad-insert-as-org (pad-id) (interactive "MPad ID: ") (let ((filename (make-temp-file "pandoc" nil ".html" (emacsconf-pad-get-html pad-id)))) (insert (shell-command-to-string (concat "pandoc -t org " (shell-quote-argument filename)))) (delete-file filename))) (defun emacsconf-pad-backup-talks () (interactive) (mapc #'emacsconf-pad-backup-talk (emacsconf-publish-prepare-for-display (emacsconf-get-talk-info)))) (provide 'emacsconf-pad) ;;; emacsconf-pad.el ends here