diff options
| -rw-r--r-- | emacsconf-publish.el | 44 | ||||
| -rw-r--r-- | emacsconf-stream.el | 49 | ||||
| -rw-r--r-- | emacsconf.el | 9 | 
3 files changed, 66 insertions, 36 deletions
diff --git a/emacsconf-publish.el b/emacsconf-publish.el index 3d87888..d4d8405 100644 --- a/emacsconf-publish.el +++ b/emacsconf-publish.el @@ -830,23 +830,6 @@ Entries are sorted chronologically, with different tracks interleaved."        (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))) -  (let ((files (directory-files emacsconf-backstage-dir nil (concat (plist-get talk :video-slug) -                                                                    ".*" -                                                                    (regexp-opt (append -                                                                                 emacsconf-main-extensions -                                                                                 (list "--main.webm" -                                                                                       "--questions.webm")) t) -                                                                    "$")))) -    (mapc -     (lambda (f) -       (copy-file -        (expand-file-name f emacsconf-backstage-dir) -        (expand-file-name f emacsconf-public-media-directory) t t)) -     files) -    (message "Copied %s" (string-join files ", ")))) -  (defun emacsconf-publish-backstage-index (&optional filename)    (interactive)    (setq filename (or filename (expand-file-name "index.html" emacsconf-backstage-dir))) @@ -1671,6 +1654,33 @@ The Q&A room for ${title} has finished. You can find more information about the  There is no live Q&A room for ${title}. You can find more information about the talk at <a href=\"${base-url}${url}\">${base-url}${url}</a>.</body></html>"             )            )))))) + +(defun emacsconf-publish-media-files-on-change (talk) +  "Publish the files and update the index." +  (interactive (list (emacsconf-complete-talk-info))) +  (when (or (not (boundp 'org-state)) +            (string= org-state "PLAYING") +            (string= org-state "TO_STREAM")) +    (if (plist-get talk :public) +        ;; Copy main extension files from backstage to public +        (let ((files (directory-files emacsconf-backstage-dir nil +                                      (concat "^" +                                              (regexp-quote (plist-get talk :video-slug)) +                                              (regexp-opt emacsconf-main-extensions))))) +          (mapc (lambda (file) +                  (copy-file (expand-file-name file emacsconf-backstage-dir) +                             (expand-file-name file emacsconf-public-media-directory) t)) +                files)) +      ;; Remove files from public +      (let ((files (directory-files emacsconf-public-media-directory nil +                                    (concat "^" +                                            (regexp-quote (plist-get talk :video-slug) +                                                          ))))) +        (mapc (lambda (file) +                (delete-file (expand-file-name file emacsconf-public-media-directory))) +              files))) +    (emacsconf-publish-public-index))) +  (defun emacsconf-publish-bbb-redirect-all ()    (interactive)    (unless (file-directory-p emacsconf-publish-current-dir) diff --git a/emacsconf-stream.el b/emacsconf-stream.el index 26a4773..1e2df14 100644 --- a/emacsconf-stream.el +++ b/emacsconf-stream.el @@ -145,15 +145,26 @@ while OTHER-FILENAME will be displayed at other times."         (plist-get talk :overlay-url)         (plist-get talk :overlay-bottom))))) +(defun emacsconf-stream-open-qa-windows-on-change (talk) +  (interactive (list (emacsconf-complete-talk-info))) +  (when (or (not (boundp 'org-state)) (string= org-state "CLOSED_Q")) +    (let ((default-directory (emacsconf-stream-track-login talk))) +      (save-window-excursion +        (emacsconf-stream-open-pad talk) +        (emacsconf-stream-join-qa talk) +        (shell-command "i3-msg 'layout splith'"))))) +  (defun emacsconf-stream-update-talk-info-on-change (talk)    "Update talk info."    (when (string= org-state "PLAYING") -    (emacsconf-stream-set-talk-info talk))) +    (save-window-excursion +      (emacsconf-stream-set-talk-info talk))))  (defun emacsconf-stream-play-talk-on-change (talk)    "Play the talk."    (when (string= org-state "PLAYING") -    (emacsconf-stream-play-video talk))) +    (save-window-excursion +      (emacsconf-stream-play-video talk))))  (defun emacsconf-stream-get-filename (talk)    "Return the local filename for the video file for TALK. @@ -165,40 +176,48 @@ Final files should be stored in /data/emacsconf/stream/YEAR/video-slug--main.web  (defun emacsconf-stream-play-video (talk)    (interactive (list (emacsconf-complete-talk-info))) -  (let ((default-directory (emacsconf-stream-track-login talk))) -    (shell-command -     (concat "~/bin/track-mpv " -			       (shell-quote-argument (emacsconf-stream-get-filename talk)))))) +  (let ((default-directory (emacsconf-stream-track-login talk)) +        (async-shell-command-buffer 'new-buffer)) +    ;; I tried using start-file-process, but I couldn't figure out how to get MPV to work. +    ;; We'll just use shell-command then, and manually move to the QA states when we want to. +    (save-window-excursion +      (shell-command +       (concat "nohup ~/bin/track-mpv " +			         (shell-quote-argument (emacsconf-stream-get-filename talk)) +               " > /dev/null 2>&1 & ")))))  (defun emacsconf-stream-open-pad (talk)    (interactive (list (emacsconf-complete-talk-info))) -  (let ((default-directory (emacsconf-stream-track-login talk))) +  (let ((default-directory (emacsconf-stream-track-login talk)) +        (async-shell-command-buffer 'new-buffer))      (shell-command -     (concat "firefox -new-window " +     (concat "nohup firefox -new-window "  	     (shell-quote-argument (plist-get talk :pad-url)) -	     " & ")))) +	     " > /dev/null 2>&1 & "))))  (defun emacsconf-stream-join-qa (talk)    "Join the Q&A for TALK.  This uses the BBB room if available, or the IRC channel if not."    (interactive (list (emacsconf-complete-talk-info))) -  (let ((default-directory (emacsconf-stream-track-login talk))) +  (let ((default-directory (emacsconf-stream-track-login talk)) +        (async-shell-command-buffer 'new-buffer))      (shell-command -     (concat "firefox -new-window " +     (concat "nohup firefox -new-window "  	     (shell-quote-argument  	       (or (plist-get talk :bbb-room)  		   (plist-get talk :webchat-url))) -	     " & ")))) +	     " > /dev/null 2>&1 & "))))  (defun emacsconf-stream-join-chat (talk)    "Join the IRC chat for TALK."    (interactive (list (emacsconf-complete-talk-info))) -  (let ((default-directory (emacsconf-stream-track-login talk))) +  (let ((default-directory (emacsconf-stream-track-login talk)) +        (async-shell-command-buffer 'new-buffer))      (shell-command -     (concat "firefox -new-window " +     (concat "nohup firefox -new-window "  	     (shell-quote-argument  	      (plist-get talk :webchat-url)) -	     " & ")))) +	     " > /dev/null 2>&1 & "))))  (defun emacsconf-stream-write-talk-overlay-svgs (talk video-filename other-filename)    (setq talk (emacsconf-stream-add-talk-props talk)) diff --git a/emacsconf.el b/emacsconf.el index c760a3a..4b6b444 100644 --- a/emacsconf.el +++ b/emacsconf.el @@ -500,7 +500,7 @@                                  emacsconf-status-types 'string= "")                   (plist-get o :status)))    (if (member (plist-get o :status) -              (split-string "PLAYING CLOSED_Q OPEN_Q UNSTREAMED_Q TO_ARCHIVE TO_EXTRACT TO_FOLLOW_UP")) +              (split-string "PLAYING CLOSED_Q OPEN_Q UNSTREAMED_Q TO_ARCHIVE TO_EXTRACT TO_FOLLOW_UP DONE"))        (plist-put o :public t))    o) @@ -1118,12 +1118,13 @@ 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 ;; play the talk +  '(emacsconf-stream-play-talk-on-change ;; play the talk +    emacsconf-stream-open-qa-windows-on-change      ;; emacsconf-erc-org-after-todo-state-change ;; announce via ERC +    emacsconf-publish-media-files-on-change      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 +    emacsconf-stream-update-talk-info-on-change ;; write to the talk text      )    "Functions to run when the todo state changes.  They will be called with TALK.")  | 
