diff options
author | Sacha Chua <sacha@sachachua.com> | 2022-10-15 22:16:56 -0400 |
---|---|---|
committer | Sacha Chua <sacha@sachachua.com> | 2022-10-15 22:16:56 -0400 |
commit | ca7e367a5219af1dce4c8aea1bf2c2fc7a65e545 (patch) | |
tree | a181b3cea9b1a6c5ae2b1ddf7c54aa91f354271f | |
parent | e219c0322909ee978a6364222afa47a247a6952d (diff) | |
download | emacsconf-el-ca7e367a5219af1dce4c8aea1bf2c2fc7a65e545.tar.xz emacsconf-el-ca7e367a5219af1dce4c8aea1bf2c2fc7a65e545.zip |
publish and schedule updates
-rw-r--r-- | emacsconf-publish.el | 26 | ||||
-rw-r--r-- | emacsconf-schedule.el | 130 | ||||
-rw-r--r-- | emacsconf.el | 57 |
3 files changed, 113 insertions, 100 deletions
diff --git a/emacsconf-publish.el b/emacsconf-publish.el index ee8f545..f5225a0 100644 --- a/emacsconf-publish.el +++ b/emacsconf-publish.el @@ -87,10 +87,14 @@ (magit-status emacsconf-directory)))) (defun emacsconf-update-schedules-in-wiki () - (emacsconf-generate-info-pages) - (emacsconf-generate-main-schedule) - (emacsconf-generate-ical) - (emacsconf-pentabarf-generate)) + (interactive) + (emacsconf-publish-with-wiki-change + (emacsconf-generate-info-pages) + (emacsconf-generate-main-schedule) + (emacsconf-generate-ical) + (emacsconf-publish-watch-pages) + (when (functionp 'emacsconf-pentabarf-generate) + (emacsconf-pentabarf-generate)))) (defun emacsconf-update-and-publish () (interactive) @@ -389,8 +393,8 @@ resources." (format "<div class=\"schedule-in-context schedule-svg-container\" data-slug=\"%s\">\n" (plist-get talk :slug)) (let* ((width 800) (height 150) (talk-date (format-time-string "%Y-%m-%d" (plist-get talk :start-time) emacsconf-timezone)) - (start (date-to-time (concat talk-date "T09:00:00" emacsconf-timezone-offset))) - (end (date-to-time (concat talk-date "T17:00:00" emacsconf-timezone-offset))) + (start (date-to-time (concat talk-date "T" emacsconf-schedule-start-time emacsconf-timezone-offset))) + (end (date-to-time (concat talk-date "T" emacsconf-schedule-end-time emacsconf-timezone-offset))) (emacsconf-schedule-svg-modify-functions (append emacsconf-schedule-svg-modify-functions @@ -578,9 +582,11 @@ Entries are sorted chronologically, with different tracks interleaved." (width 600)) (mapconcat (lambda (day) (let ((day-start (date-to-time - (concat (format-time-string "%Y-%m-%dT09:00" (plist-get (cadr day) :start-time)) + (concat (format-time-string "%Y-%m-%dT" (plist-get (cadr day) :start-time) emacsconf-timezone) + emacsconf-schedule-start-time emacsconf-timezone-offset))) - (day-end (date-to-time (concat (format-time-string "%Y-%m-%dT17:00" (plist-get (cadr day) :start-time)) + (day-end (date-to-time (concat (format-time-string "%Y-%m-%dT" (plist-get (cadr day) :start-time) emacsconf-timezone) + emacsconf-schedule-end-time emacsconf-timezone-offset)))) (concat (if (> (length links) 1) (concat "Jump to: " (string-join links " - ")) "") @@ -1190,8 +1196,8 @@ Entries are sorted chronologically, with different tracks interleaved." (svg-print (emacsconf-schedule-svg 800 300 (emacsconf-get-talk-info))) (insert "</div>")) (mapc (lambda (day) - (let ((start (date-to-time (concat (car day) "T09:00:00" emacsconf-timezone-offset))) - (end (date-to-time (concat (car day) "T17:00:00" emacsconf-timezone-offset)))) + (let ((start (date-to-time (concat (car day) "T" emacsconf-schedule-start-time emacsconf-timezone-offset))) + (end (date-to-time (concat (car day) "T" emacsconf-schedule-end-time emacsconf-timezone-offset)))) (with-temp-file (expand-file-name (concat "schedule-" (car day) ".md") year-dir) (insert "<div class=\"schedule-svg-container\">") (svg-print (emacsconf-schedule-svg-day diff --git a/emacsconf-schedule.el b/emacsconf-schedule.el index 8d4e75a..630ae61 100644 --- a/emacsconf-schedule.el +++ b/emacsconf-schedule.el @@ -43,12 +43,14 @@ Each function should take the info and manipulate it as needed, returning the ne (defvar emacsconf-schedule-break-time 10 "Number of minutes for break.") (defvar emacsconf-schedule-lunch-time 45 "Number of minutes for lunch.") +(defvar emacsconf-schedule-start-time "09:00:00") +(defvar emacsconf-schedule-end-time "17:30:00") (defun emacsconf-schedule-override-breaks (info) (mapcar (lambda (o) - (when (string-match "BREAK" (plist-get o :title)) + (when (string-match "BREAK" (or (plist-get o :title) "")) (plist-put o :time (number-to-string emacsconf-schedule-break-time))) - (when (string-match "LUNCH" (plist-get o :title)) + (when (string-match "LUNCH" (or (plist-get o :title) "")) (plist-put o :time (number-to-string emacsconf-schedule-lunch-time))) o) info)) @@ -231,51 +233,55 @@ Each function should take the info and manipulate it as needed, returning the ne (let* ((offset (floor (* scale (float-time (time-subtract (plist-get o :start-time) start-time))))) (size (floor (* scale (float-time (time-subtract (plist-get o :end-time) (plist-get o :start-time)))))) (x (+ base-x offset)) - (y base-y)) + (y base-y) + (node (dom-node + 'rect + `((x . ,x) + (y . ,y) + (opacity . "0.8") + (width . ,size) + (height . ,(1- height)) + (stroke . "black") + (stroke-dasharray . + ,(if (string-match "live" (or (plist-get o :q-and-a) "live")) + "" + "5,5,5" + )) + (fill . ,(cond + ((string-match "BREAK\\|LUNCH" (plist-get o :title)) "white") + ((plist-get o :invalid) "red") + ((string-match "EST" + (or (plist-get o :availability) "")) + "lightgray") + (t "lightgreen")))))) + (parent (dom-node + 'a + `((href . ,(concat "/" (plist-get o :url))) + (title . ,(plist-get o :title))) + (dom-node 'title nil + (concat (format-time-string "%l:%M-" (plist-get o :start-time) emacsconf-timezone) + (format-time-string "%l:%M " (plist-get o :end-time) emacsconf-timezone) + (plist-get o :title))) + node + (dom-node + 'g + `((transform . ,(format "translate(%d,%d)" + (+ x size -2) (+ y height -2)))) + (dom-node + 'text + '((fill . "black") + (x . 0) + (y . 0) + (font-size . 10) + (transform . "rotate(-90)")) + (svg--encode-text (or (plist-get o :slug) (plist-get o :title)))))))) + (run-hook-with-args + 'emacsconf-schedule-svg-modify-functions + o node parent) (dom-append-child svg - (dom-node - 'a - `((href . ,(concat "/" (plist-get o :url))) - (title . ,(plist-get o :title))) - (dom-node 'title nil (plist-get o :title)) - (let ((node (dom-node - 'rect - `((x . ,x) - (y . ,y) - (opacity . "0.8") - (width . ,size) - (height . ,(1- height)) - (stroke . "black") - (stroke-dasharray . - ,(if (string-match "live" (or (plist-get o :q-and-a) "live")) - "" - "5,5,5" - )) - (fill . ,(cond - ((string-match "BREAK\\|LUNCH" (plist-get o :title)) "white") - ((plist-get o :invalid) "red") - ((string-match "EST" - (or (plist-get o :availability) "")) - "lightgray") - (t "lightgreen"))))))) - (run-hook-with-args - 'emacsconf-schedule-svg-modify-functions - o node) - node) - (dom-node - 'g - `((transform . ,(format "translate(%d,%d)" - (+ x size -2) (+ y height -2)))) - (dom-node - 'text - '((fill . "black") - (x . 0) - (y . 0) - (font-size . 10) - (transform . "rotate(-90)")) - (svg--encode-text (or (plist-get o :slug) (plist-get o :title))))))))) - info))) + parent))) + info))) (defun emacsconf-schedule-svg-day (elem label width height start end tracks) (let* ((label-margin 15) @@ -317,15 +323,7 @@ Each function should take the info and manipulate it as needed, returning the ne (setq time (time-add time (seconds-to-time 3600))))) elem)) -(defun emacsconf-by-tracks (info) - (mapcar (lambda (track) - (seq-filter - (lambda (talk) - (string= (plist-get talk :track) (plist-get track :name))) - info)) - emacsconf-tracks)) - -(defun emacsconf-schedule-svg-color-by-track (o node) +(defun emacsconf-schedule-svg-color-by-track (o node &optional parent) (let ((track (emacsconf-get-track (plist-get o :track)))) (when track (dom-set-attribute node 'fill (plist-get track :color))))) @@ -342,17 +340,12 @@ Each function should take the info and manipulate it as needed, returning the ne (emacsconf-schedule-svg-days width height (mapcar (lambda (o) - (let ((start (concat (car o) "T09:00:00" emacsconf-timezone-offset)) - (end (concat (car o) "T17:00:00" emacsconf-timezone-offset))) + (let ((start (concat (car o) "T" emacsconf-schedule-start-time emacsconf-timezone-offset)) + (end (concat (car o) "T" emacsconf-schedule-end-time emacsconf-timezone-offset))) (list :label (format-time-string "%A" (date-to-time (car o))) :start start :end end - :tracks (mapcar (lambda (track) - (seq-filter - (lambda (talk) - (string= (plist-get talk :track) (plist-get track :name))) - (cdr o))) - emacsconf-tracks)))) + :tracks (emacsconf-by-track (cdr o))))) days)))) (defun emacsconf-schedule-svg-days (width height days) @@ -410,11 +403,12 @@ Each function should take the info and manipulate it as needed, returning the ne (defun emacsconf-schedule-allocate-buffer-time (info) (mapcar (lambda (o) (when (plist-get o :slug) - (plist-put o :buffer - (number-to-string - (if (string-match "live" (plist-get o :q-and-a)) - emacsconf-schedule-default-buffer-minutes-for-live-q-and-a - emacsconf-schedule-default-buffer-minutes)))) + (unless (plist-get o :buffer) + (plist-put o :buffer + (number-to-string + (if (string-match "live" (plist-get o :q-and-a)) + emacsconf-schedule-default-buffer-minutes-for-live-q-and-a + emacsconf-schedule-default-buffer-minutes))))) o) info)) @@ -565,7 +559,7 @@ Both start and end time are tested." track)) schedule) ;; start and end regexp - (apply #'emacsconf-schedule-get-subsequence schedule track))) + (apply #'emacsconf-schedule-get-subsequence schedule (plist-get track :start) (plist-get track :end)))) (plist-get day :tracks))) day) tracks)) diff --git a/emacsconf.el b/emacsconf.el index b850302..d594f15 100644 --- a/emacsconf.el +++ b/emacsconf.el @@ -130,7 +130,7 @@ (`ascii (format "%s (%s)" desc path)) (`markdown (format "[[%s|%s/talks/%s]]" desc emacsconf-year link)) - (t path)))) + (_ path)))) (with-eval-after-load 'org (org-link-set-parameters @@ -194,9 +194,8 @@ (emacsconf-go-to-talk ,search) ,@body)) -(defun emacsconf-status-types () - ;; TODO - ) +(defvar emacsconf-status-types + '(("WAITING_FOR_PREREC" . "Waiting for video from speaker"))) (defun emacsconf-get-talk-categories (o) (org-narrow-to-subtree) @@ -356,7 +355,7 @@ (defun emacsconf-add-talk-status (o) (plist-put o :status-label (assoc-default (plist-get o :status) - (emacsconf-status-types) 'string= ""))) + emacsconf-status-types 'string= ""))) (defvar emacsconf-talk-info-functions '(emacsconf-get-talk-info-from-properties @@ -751,25 +750,24 @@ Include some other things, too, such as emacsconf-year, title, name, email, url, (format-time-string "%z" (date-to-time emacsconf-date) emacsconf-timezone) "Timezone offset for `emacsconf-timezone' on `emacsconf-date'.") -(defun emacsconf-timezone-strings (o) +(defun emacsconf-timezone-string (o tz) (let* ((timestamp (org-timestamp-from-string (plist-get o :scheduled))) (start (org-timestamp-to-time (org-timestamp-split-range timestamp))) (end (org-timestamp-to-time (org-timestamp-split-range timestamp t)))) - (mapcar - (lambda (tz) - (if (string= tz "UTC") - (format "%s - %s " - (format-time-string "%A, %b %-e %Y, ~%-l:%M %p" - start tz) - (format-time-string "%-l:%M %p %Z" - end tz)) - (format "%s - %s (%s)" - (format-time-string "%A, %b %-e %Y, ~%-l:%M %p" - start tz) - (format-time-string "%-l:%M %p %Z" - end tz) - tz))) - emacsconf-timezones))) + (if (string= tz "UTC") + (format "%s - %s " + (format-time-string "%A, %b %-e %Y, ~%-l:%M %p" + start tz) + (format-time-string "%-l:%M %p %Z" + end tz)) + (format "%s - %s (%s)" + (format-time-string "%A, %b %-e %Y, ~%-l:%M %p" + start tz) + (format-time-string "%-l:%M %p %Z" + end tz) + tz)))) +(defun emacsconf-timezone-strings (o &optional timezones) + (mapcar (lambda (tz) (emacsconf-timezone-string o tz)) (or timezones emacsconf-timezones))) (defun emacsconf-convert-from-timezone (timezone time) (interactive (list (completing-read "From zone: " tzc-time-zones) @@ -921,7 +919,22 @@ Include some other things, too, such as emacsconf-year, title, name, email, url, (defun emacsconf-get-track (name) (seq-find (lambda (track) (string= name (plist-get track :name))) emacsconf-tracks)) - +(defun emacsconf-by-track (info) + (mapcar (lambda (track) + (seq-filter + (lambda (talk) + (string= (plist-get talk :track) (plist-get track :name))) + info)) + emacsconf-tracks)) + +(defun emacsconf-by-day (info) + (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))) + info) + #'emacsconf-sort-by-scheduled))) (provide 'emacsconf) ;;; emacsconf.el ends here |