From c5a4eab85deb982ff850d70c599bf4c3b7415fcf Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Mon, 5 Dec 2022 14:23:16 -0500 Subject: fix notifications? --- emacsconf-stream.el | 11 +++++++---- emacsconf.el | 22 +++++++++++++--------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/emacsconf-stream.el b/emacsconf-stream.el index 0608649..60fad4d 100644 --- a/emacsconf-stream.el +++ b/emacsconf-stream.el @@ -874,8 +874,8 @@ ffplay URL notification))))) (defun emacsconf-stream-update-talk-status-from-timer (talk new-status &optional notification) - (when notification - (apply #'notifications-notify notification)) + ;; (when notification + ;; (apply #'notifications-notify notification)) (emacsconf-update-talk-status-with-hooks (plist-get talk :slug) "." new-status)) (defun emacsconf-stream-schedule-timers (&optional info) @@ -887,20 +887,23 @@ ffplay URL (mapc (lambda (talk) (when (and (time-less-p now (plist-get talk :start-time))) (emacsconf-stream-schedule-talk-status-change talk (plist-get talk :start-time) "PLAYING" - `(:title (concat "Starting " (plist-get talk :qa))))) + `(:title (concat "Starting " (plist-get talk :slug))))) (when (and (plist-get talk :video-file) (plist-get talk :qa-time) + (not (string-match "none" (or (plist-get talk :q-and-a) "none"))) (null (plist-get talk :stream-files)) ;; can't tell when this is (time-less-p now (plist-get talk :qa-time))) (emacsconf-stream-schedule-talk-status-change talk (plist-get talk :qa-time) "CLOSED_Q" - `(:title (concat "Q&A for " (plist-get talk :qa) " (" (plist-get talk :q-and-a) ")"))))) + `(:title (concat "Q&A for " (plist-get talk :slug) " (" (plist-get talk :q-and-a) ")")))) + ) info))) ;; (notifications-notify :title "Hello") (defun emacsconf-stream-cancel-all-timers () (interactive) (cancel-function-timers #'emacsconf-update-talk-status-with-hooks) + (cancel-function-timers #'emacsconf-stream-update-talk-status-from-timer) (setq emacsconf-stream-timers nil)) (defun emacsconf-stream-send-to-mpv (talk-or-track command &optional parse) diff --git a/emacsconf.el b/emacsconf.el index 6197f80..51ca4b0 100644 --- a/emacsconf.el +++ b/emacsconf.el @@ -287,15 +287,19 @@ :complete (lambda () (concat "emacsconf:" (emacsconf-complete-slug))) :export #'emacsconf-export-slug)) +(defvar emacsconf-complete-talk-cache nil) +;; (setq emacsconf-complete-talk-cache (mapcar (lambda (o) (string-join (delq nil (mapcar (lambda (f) (plist-get o f)) '(:slug :title :speakers :irc))) " - ")) (emacsconf-get-talk-info))) (defun emacsconf-complete-talk (&optional info) (let ((choices - (mapcar (lambda (o) - (string-join - (delq nil - (mapcar (lambda (f) (plist-get o f)) '(:slug :title :speakers :irc))) - " - ")) - (or info (emacsconf-get-talk-info))))) + (if (and (null info) emacsconf-complete-talk-cache) + emacsconf-complete-talk-cache + (mapcar (lambda (o) + (string-join + (delq nil + (mapcar (lambda (f) (plist-get o f)) '(:slug :title :speakers :irc))) + " - ")) + (or info (emacsconf-get-talk-info)))))) (completing-read "Talk: " (lambda (string predicate action) @@ -610,9 +614,9 @@ (* 60 (string-to-number (or (plist-get o :video-time) "0"))) (* 60 (string-to-number (or (plist-get o :intro-time) "0"))) ))) - (plist-put o :qa-time - (plist-get o :live-time)) - + (unless (string-match "none\\|after" (or (plist-get o :q-and-a) "none")) + (plist-put o :qa-time + (plist-get o :live-time))) (plist-put o :checkin-label "30 minutes before the scheduled start of your Q&A, since you have a pre-recorded video") (when (plist-get o :video-time) -- cgit v1.2.3