From 8ca6f842ad2f9b2df4b798779077404ef9d4d422 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Wed, 2 Nov 2022 14:01:05 -0400 Subject: Go back to using text files for the news --- emacsconf-stream.el | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'emacsconf-stream.el') diff --git a/emacsconf-stream.el b/emacsconf-stream.el index 19fe049..07743cd 100644 --- a/emacsconf-stream.el +++ b/emacsconf-stream.el @@ -42,17 +42,9 @@ Files should be in YEAR/video-slug--main.webm and video-slug--main.vtt.") (defun emacsconf-stream-set-news (track message) (interactive (list (emacsconf-complete-track) (read-string "Message: "))) (let* ((home (concat (emacsconf-stream-track-login track) "~")) - (default-directory home) - (filename (expand-file-name "other.svg" home)) - (dom (xml-parse-file filename))) - (emacsconf-stream-svg-set-text dom "news" message) - (with-temp-file filename (dom-print dom t)) - (with-temp-file (expand-file-name "video.svg" home) - (emacsconf-stream-svg-set-text dom "bottom" "") - (dom-print dom t)) - ;; (shell-command "inkscape --export-type=png --export-dpi=96 --export-background-opacity=0 video.svg") - ;; (shell-command "inkscape --export-type=png --export-dpi=96 --export-background-opacity=0 other.svg") - )) + (filename (expand-file-name "news.txt" home))) + (with-temp-file filename + (insert message)))) (defun emacsconf-stream-broadcast (message) (interactive (list (read-string "Message: "))) @@ -75,17 +67,14 @@ Files should be in YEAR/video-slug--main.webm and video-slug--main.vtt.") (defun emacsconf-stream-svg-set-text (dom id text) "Update DOM to set the tspan in the element with ID to TEXT. If the element doesn't have a tspan child, use the element itself." - (setq text (svg--encode-text text)) + (setq text (if (string= text "") " " + (svg--encode-text text))) (let ((node (or (dom-child-by-tag (car (dom-by-id dom id)) 'tspan) (dom-by-id dom id)))) (cond ((null node)) ; skip - ((and (string= text "") - (= (length node) 2))) ; already nothing, skip - ((string= text "") - (setf (elt node 2) "")) ((= (length node) 2) (nconc node (list text))) (t (setf (elt node 2) text))))) -- cgit v1.2.3