From 2fa1aadff4fcd6258c9ec2c49f6f6500575738c6 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Sun, 22 Oct 2023 08:47:16 -0400 Subject: making indices --- emacsconf-publish.el | 151 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 89 insertions(+), 62 deletions(-) diff --git a/emacsconf-publish.el b/emacsconf-publish.el index 827ed8d..4da789d 100644 --- a/emacsconf-publish.el +++ b/emacsconf-publish.el @@ -116,21 +116,22 @@ (emacsconf-publish-update-conf-html) (setq emacsconf-info (emacsconf-get-talk-info)))) -(defun emacsconf-update-media () +(defun emacsconf-publish-update-media () + "Update public media.emacsconf.org directory." (interactive) (emacsconf-publish-public-index-on-wiki) (when emacsconf-public-media-directory (emacsconf-publish-public-index (expand-file-name "index.html" emacsconf-public-media-directory)) (emacsconf-publish-playlist (expand-file-name "index.m3u" emacsconf-public-media-directory) - (concat emacsconf-name emacsconf-year) - (emacsconf-public-talks emacsconf-info) - (format "https://media.emacsconf.org/%s/" emacsconf-year))) + (concat emacsconf-name emacsconf-year) + (emacsconf-publish-prepare-for-display (emacsconf-get-talk-info)) + (format "https://media.emacsconf.org/%s/" emacsconf-year))) (when emacsconf-backstage-dir (emacsconf-publish-backstage-index (expand-file-name "index.html" emacsconf-backstage-dir))) (emacsconf-publish-playlist (expand-file-name "index.m3u" emacsconf-backstage-dir) - (concat emacsconf-name emacsconf-year) - (emacsconf-filter-talks emacsconf-info) - (format "https://media.emacsconf.org/%s/backstage/" emacsconf-year))) + (concat emacsconf-name emacsconf-year) + (emacsconf-publish-prepare-for-display (emacsconf-get-talk-info)) + (format "https://media.emacsconf.org/%s/backstage/" emacsconf-year))) (defun emacsconf-publish-index-card (talk &optional extensions) "Format an HTML card for TALK, linking the files in EXTENSIONS." @@ -207,6 +208,7 @@ emacsconf-timezones)) (defun emacsconf-publish-format-res-talks (info) + "Format lines for the backstage index." (mapconcat (lambda (o) (concat @@ -224,27 +226,32 @@ "" "" "" (format-time-string "%-l:%M" (plist-get o :start-time) emacsconf-timezone) "" - "" (or (plist-get o :slug) "") "" + "" (format "%s" + emacsconf-base-url + emacsconf-year + (plist-get o :slug) + (plist-get o :slug)) + "" "" (or (plist-get o :title) "") "" "")) info "\n")) + (defun emacsconf-publish-res-index () "Publish BBB room URLs and pad links for volunteer convenience." (interactive) - (let ((emacsconf-use-absolute-url t) - (emacsconf-base-url "") - (info (mapcar (lambda (o) - (append (list - :url (concat "#" (plist-get o :slug))) - (if (and (string-match "live" (or (plist-get o :q-and-a) "")) - (plist-get o :bbb-room)) - (append (list - :qa-link - (format "Join Q&A" (plist-get o :bbb-room))) - o) - o))) - (emacsconf-publish-prepare-for-display (emacsconf-get-talk-info))))) + (let* ((emacsconf-publishing-phase 'conference) + (info (mapcar (lambda (o) + (append (list + :url (concat "#" (plist-get o :slug))) + (if (and (string-match "live" (or (plist-get o :q-and-a) "")) + (plist-get o :bbb-room)) + (append (list + :qa-link + (format "Join Q&A" (plist-get o :bbb-room))) + o) + o))) + (emacsconf-publish-prepare-for-display (emacsconf-get-talk-info))))) (mapc (lambda (track) (let* @@ -255,26 +262,25 @@ (concat "
" - (with-temp-buffer - (svg-print (emacsconf-schedule-svg 800 300 info)) - (buffer-string)) + (let ((emacsconf-use-absolute-url t) + (emacsconf-base-url "")) + (with-temp-buffer + (svg-print (emacsconf-schedule-svg 800 300 info)) + (buffer-string))) "

" (plist-get track :name) "

" - "" - (emacsconf-publish-format-res-talks - (emacsconf-publish-prepare-for-display - (emacsconf-filter-talks-by-time - (format "2022-12-03T08:00:00%s" emacsconf-timezone-offset) - (format "2022-12-03T18:00:00%s" emacsconf-timezone-offset) - track-talks))) - "" - (emacsconf-publish-format-res-talks - (emacsconf-publish-prepare-for-display - (emacsconf-filter-talks-by-time - (format "2022-12-04T08:00:00%s" emacsconf-timezone-offset) - (format "2022-12-04T18:00:00%s" emacsconf-timezone-offset) - track-talks))) + (mapconcat + (lambda (day) + (format + " + +%s" + (car day) (emacsconf-publish-format-res-talks (cdr day)))) + (seq-group-by + (lambda (o) (format-time-string "%A, %b %-e" (plist-get o :start-time))) + track-talks) + "\n") "
Saturday
Sunday
%s
Q&APadChatTimeSlugTitle
"))) (with-temp-file (expand-file-name (format "index-%s.html" (plist-get track :id)) emacsconf-res-dir) (insert result)) @@ -1399,21 +1405,25 @@ answers without needing to listen to everything again. You can see " - "

" emacsconf-name " " emacsconf-year "

" - "
M3U playlist for playing in MPV and other players
" - "
Quick links: " (mapconcat (lambda (o) (format "%s" - (plist-get o :slug) - (plist-get o :slug))) - info ", ") - "
" - "
    " - (mapconcat (lambda (o) (emacsconf-publish-public-index-for-talk o files)) info "\n") - "
" - (if (file-exists-p (expand-file-name "include-in-public-index.html" emacsconf-cache-dir)) - (with-temp-buffer (insert-file-contents (expand-file-name "include-in-public-index.html" emacsconf-cache-dir)) (buffer-string)) - "") - "")))) + (emacsconf-replace-plist-in-string + (list + :conf-name emacsconf-name + :year emacsconf-year + :quick-links (mapconcat (lambda (o) (format "%s" + (plist-get o :slug) + (plist-get o :slug))) + info ", ") + :videos (mapconcat (lambda (o) (emacsconf-publish-public-index-for-talk o files)) info "\n") + :include (if (file-exists-p (expand-file-name "include-in-public-index.html" emacsconf-cache-dir)) + (with-temp-buffer (insert-file-contents (expand-file-name "include-in-public-index.html" emacsconf-cache-dir)) (buffer-string)) + "")) + " +

${conf-name} ${year}

+
M3U playlist for playing in MPV and other players
+
Quick links: ${quick-links}
+
    ${videos}
+${include} +"))))) (defun emacsconf-publish-public-index-on-wiki () (interactive) @@ -1546,7 +1556,7 @@ answers without needing to listen to everything again. You can see tracks)))) -(defvar emacsconf-publish-current-dir "/ssh:orga@media.emacsconf.org:/var/www/media.emacsconf.org/2022/current" +(defvar emacsconf-publish-current-dir + (expand-file-name + "current" + (expand-file-name + emacsconf-year + "/ssh:orga@media.emacsconf.org:/var/www/media.emacsconf.org")) "Directory to publish BBB redirects and current information to.") - ;; (assert (eq (emacsconf-get-bbb-state '(:status "OPEN_Q")) 'open)) ;; (assert (eq (emacsconf-get-bbb-state '(:status "TO_ARCHIVE")) 'after)) +(defun emacsconf-publish-make-directories () + "Set up all the directories needed." + (interactive) + (dolist (dir + (list + emacsconf-stream-asset-dir + emacsconf-stream-overlay-dir + emacsconf-cache-dir)) + (unless (file-directory-p dir) + (make-directory dir t)))) (defun emacsconf-publish-bbb-static-redirects () "Create emergency redirects that can be copied over the right location." @@ -2228,7 +2252,9 @@ when the host has opened the Q&A.

(let ((emacsconf-publish-current-dir (expand-file-name state - (expand-file-name "redirects" emacsconf-stream-asset-dir)))) + (expand-file-name + "redirects" + (expand-file-name "assets" emacsconf-backstage-dir))))) (unless (file-directory-p emacsconf-publish-current-dir) (make-directory emacsconf-publish-current-dir t)) (mapc @@ -2236,6 +2262,7 @@ when the host has opened the Q&A.

(emacsconf-publish-bbb-redirect talk (intern state))) (emacsconf-publish-prepare-for-display (emacsconf-get-talk-info))))) '("before" "open" "after"))) + (defun emacsconf-publish-bbb-redirect (talk &optional status) "Update the publicly-available redirect for TALK." (interactive (list (emacsconf-complete-talk-info))) @@ -2289,7 +2316,7 @@ There is no live Q&A room for ${title}. You can find more information about the (delete-file (expand-file-name file emacsconf-public-media-directory))) files))) (emacsconf-publish-public-index) - (emacsconf-generate-playlist + (emacsconf-publish-playlist (expand-file-name "index.m3u" emacsconf-public-media-directory) (concat emacsconf-name " " emacsconf-year) (emacsconf-public-talks (emacsconf-get-talk-info)))))) @@ -2298,7 +2325,7 @@ There is no live Q&A room for ${title}. You can find more information about the (interactive) (unless (file-directory-p emacsconf-publish-current-dir) (make-directory emacsconf-publish-current-dir)) - (mapc #'emacsconf-publish-bbb-redirect (emacsconf-filter-talks (emacsconf-get-talk-info)))) + (mapc #'emacsconf-publish-bbb-redirect (emacsconf-publish-prepare-for-display (emacsconf-get-talk-info)))) ;; (emacsconf-publish-bbb-redirect '(:slug "test" :status "TO_STREAM" :bbb-room "https://bbb.emacsverse.org/b/sac-fwh-pnz-ogz" :title "Test room" :q-and-a "live" :url "2022/talks/test")) ;; (emacsconf-publish-bbb-redirect '(:slug "test" :status "CLOSED_Q" :bbb-room "https://bbb.emacsverse.org/b/sac-fwh-pnz-ogz" :title "Test room" :q-and-a "live" :url "2022/talks/test")) ;; (emacsconf-publish-bbb-redirect '(:slug "test" :status "OPEN_Q" :bbb-room "https://bbb.emacsverse.org/b/sac-fwh-pnz-ogz" :title "Test room" :q-and-a "live" :url "2022/talks/test")) @@ -2448,7 +2475,7 @@ This video is available under the terms of the Creative Commons Attribution-Shar (list :file file :tags "emacs,emacsconf,answers" - :playlist "EmacsConf 2022" + :playlist (concat emacsconf-name " " emacsconf-year) :date (plist-get talk :start-time) :title (if (< (length title) 100) title (concat (substring title 0 97) "...")) :description (emacsconf-publish-answers-description talk platform)))) @@ -2469,7 +2496,7 @@ This video is available under the terms of the Creative Commons Attribution-Shar (list :file file :tags "emacs,emacsconf,answers" - :playlist "EmacsConf 2022" + :playlist (concat emacsconf-name " " emacsconf-year) :date (plist-get talk :start-time) :title (if (< (length title) 100) title (concat (substring title 0 97) "...")) :description (emacsconf-publish-answers-description talk 'youtube) -- cgit v1.2.3