From 0642ee2e27625bbe8b3dd02fb3b721a67ad707e7 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Thu, 6 Oct 2022 11:14:32 -0400 Subject: Tweak schedule --- emacsconf-publish.el | 183 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 116 insertions(+), 67 deletions(-) diff --git a/emacsconf-publish.el b/emacsconf-publish.el index 5fb470b..74965a0 100644 --- a/emacsconf-publish.el +++ b/emacsconf-publish.el @@ -519,7 +519,7 @@ resources." (if (eq emacsconf-publishing-phase 'program) (let ((sorted (sort (emacsconf-active-talks (emacsconf-filter-talks - (emacsconf-get-talk-info))) + (or info (emacsconf-get-talk-info)))) #'emacsconf-sort-by-scheduled))) (concat "Jump to development talks\n\n# General talks\n" @@ -528,8 +528,52 @@ resources." "\n\n# Development talks\n" (emacsconf-format-main-schedule (seq-filter (lambda (o) (string= (plist-get o :track) "Development")) sorted)))) - (emacsconf-format-main-schedule - (emacsconf-get-talk-info))))) + (let* ((by-day (seq-group-by (lambda (o) + (format-time-string "%Y-%m-%d" (plist-get o :start-time) emacsconf-timezone)) + (sort (seq-filter (lambda (o) + (or (plist-get o :slug) + (plist-get o :include-in-info))) + (emacsconf-get-talk-info)) + #'emacsconf-sort-by-scheduled))) + (dates (seq-map (lambda (o) (plist-get (cadr o) :start-time)) + by-day)) + (links (mapcar (lambda (o) + (format "%s" + (format-time-string "%Y-%m-%d" o emacsconf-timezone) + (format-time-string "%a %b %-e" o emacsconf-timezone))) + dates))) + (mapconcat (lambda (day) + (with-temp-file (expand-file-name (concat emacsconf-year "/talks/" + (format-time-string "schedule-%Y-%m-%d.svg" + (plist-get (cadr day) :start-time) + emacsconf-timezone)) + emacsconf-directory) + (let ((height 200) (width 800)) + (svg-print + (emacsconf-schedule-svg-day + (svg-create width height) + (format-time-string "%a" (plist-get (cadr day) :start-time) emacsconf-timezone) + width height + (date-to-time (format-time-string "%Y-%m-%d 9:00" (plist-get (cadr day) :start-time))) + (date-to-time (format-time-string "%Y-%m-%d 17:00" (plist-get (cadr day) :start-time))) + (list (seq-filter (lambda (o) (string= (plist-get o :track) "General")) (cdr day)) + (seq-filter (lambda (o) (string= (plist-get o :track) "Development")) (cdr day))) + )))) + (concat + (if (> (length links) 1) (concat "Jump to: " (string-join links " - ")) "") + (format "\n" + (format-time-string "%Y-%m-%d" + (plist-get (cadr day) :start-time) + emacsconf-timezone)) + (format-time-string "# %A %b %-e, %Y\n" (plist-get (cadr day) :start-time) emacsconf-timezone) + (format "\"Schedule\"/ \n" + emacsconf-year + (format-time-string "%Y-%m-%d" + (plist-get (cadr day) :start-time) + emacsconf-timezone)) + (emacsconf-format-main-schedule (cdr day)))) + by-day + "\n\n"))))) (magit-status-setup-buffer emacsconf-directory)) (defun emacsconf-format-talk-link (talk) @@ -558,72 +602,77 @@ resources." (apply '+ (mapcar (lambda (info) (string-to-number (plist-get info :duration))) received))))) + (defun emacsconf-format-main-schedule (info) (let* ((cancelled (seq-filter (lambda (o) (string= (plist-get o :status) "CANCELLED")) info))) - (format "%s%s
%s" - (pcase emacsconf-publishing-phase - ('program "TitleSpeaker(s)") - ('schedule "StatusStartTitleSpeaker(s)") - ('resources "TitleSpeaker(s)Resources")) - (mapconcat - (lambda (o) - (let* ((time-fmt "%l:%M %p") - (timestamp (org-timestamp-from-string (plist-get o :scheduled))) - (start (if timestamp (format-time-string time-fmt (org-timestamp-to-time (org-timestamp-split-range timestamp))) "")) - ;; (end (if timestamp (format-time-string time-fmt (org-timestamp-to-time (org-timestamp-split-range timestamp t))) "")) - (title (plist-get o :title)) - (status (pcase (plist-get o :status) - ("CAPTIONED" "captioned") - ("PREREC_RECEIVED" "received") - ("DONE" "done") - ("STARTED" "now playing") - (_ ""))) - (speakers (or (plist-get o :speakers) ""))) - (pcase emacsconf-publishing-phase - ('program - (if (eq (plist-get o :type) 'headline) - (format "%s" - (if (plist-get o :slug) - (emacsconf-format-talk-link o) - title)) - (format "%s%s" - (emacsconf-format-talk-link o) - speakers))) - ('schedule - (if (eq (plist-get o :type) 'headline) - (format "%s" - (if (plist-get o :slug) - (emacsconf-format-talk-link o) - title)) - (format "%s~%s%s%s" - status - start (emacsconf-format-talk-link o) speakers))) - ('resources - (if (eq (plist-get o :type) 'headline) - (format "%s" - (if (plist-get o :slug) - (emacsconf-format-talk-link o) - title)) - (format "%s%s
    %s
" - (emacsconf-format-talk-link o) speakers - (mapconcat (lambda (s) (concat "
  • " s "
  • ")) - (emacsconf-link-file-formats-as-list - (append o - (list :base-url (format "%s%s/" emacsconf-media-base-url emacsconf-year))) - (append emacsconf-main-extensions '("--main.webm"))) - ""))))))) - (seq-remove (lambda (o) (string= (plist-get o :status) "CANCELLED")) - info) - "\n") - (if (> (length cancelled) 0) - (format "
    Cancelled:
      %s
    " - (mapconcat (lambda (talk) (format "
  • %s - %s
  • " - emacsconf-year - (plist-get talk :slug) - (plist-get talk :title) - (plist-get talk :speakers))) - cancelled "\n")) - "")))) + (concat + (format + "
    \n" + (format-time-string "%FT%T%z" (plist-get (car info) :start-time) t)) + (mapconcat + (lambda (o) + (let* ((status (pcase (plist-get o :status) + ("CAPTIONED" "captioned") + ("PREREC_RECEIVED" "received") + ("DONE" "done") + ("STARTED" "now playing") + (_ nil)))) + (format "[[!template id=sched%s%s]]" + (let ((result "") + (attrs (list + :title (plist-get o :title) + :url (plist-get o :url) + :speakers (plist-get o :speakers) + :track (plist-get o :track) + :slug (plist-get o :slug) + :status (if (eq emacsconf-publishing-phase 'program) + nil + status) + :time (if (eq emacsconf-publishing-phase 'program) + nil + (plist-get o :time)) + :startutc + (if (eq emacsconf-publishing-phase 'program) + nil + (format-time-string "%FT%T%z" (plist-get o :start-time) t)) + :start + (if (eq emacsconf-publishing-phase 'program) + nil + (format-time-string "%-l:%M" (plist-get o :start-time))) + :end + (if (eq emacsconf-publishing-phase 'program) + nil + (format-time-string "%-l:%M" (plist-get o :end-time))) + :q-and-a + (plist-get o :q-and-a) + ))) + (while attrs + (let ((field (pop attrs)) + (val (pop attrs))) + (when val + (setq result (concat result " " (substring (symbol-name field) 1) "=\"" val "\""))))) + result) + (if (eq emacsconf-publishing-phase 'resources) + (format" resources=\"\"\"\n%s\n\"\"\"" + (mapconcat (lambda (s) (concat "
  • " s "
  • ")) + (emacsconf-link-file-formats-as-list + (append o + (list :base-url (format "%s%s/" emacsconf-media-base-url emacsconf-year))) + (append emacsconf-main-extensions '("--main.webm"))) + "")) + "")))) + (emacsconf-active-talks info) + "\n") + "\n
    \n" + (if (> (length cancelled) 0) + (format "
    Cancelled:
      %s
    " + (mapconcat (lambda (talk) (format "
  • %s - %s
  • " + emacsconf-year + (plist-get talk :slug) + (plist-get talk :title) + (plist-get talk :speakers))) + cancelled "\n")) + "")))) (defun emacsconf-timezone-strings (o) (let* ((timestamp (org-timestamp-from-string (plist-get o :scheduled))) -- cgit v1.2.3