From bfb6755059e69e1f48eb08f9e791fce132fdf59f Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Sun, 20 Dec 2020 00:26:59 -0500 Subject: Add transcript for 04 --- 2020/organizers-notebook.org | 52 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to '2020/organizers-notebook.org') diff --git a/2020/organizers-notebook.org b/2020/organizers-notebook.org index f2a1e707..142ac539 100644 --- a/2020/organizers-notebook.org +++ b/2020/organizers-notebook.org @@ -7,7 +7,8 @@ [[!toc levels=4]] #+end_export -[[elisp:(progn (org-md-export-to-markdown) (org-babel-tangle))][Export and tangle]] +- [[elisp:(progn (org-md-export-to-markdown) (org-babel-tangle))][Export and tangle]] +- [[elisp:(org-babel-execute-buffer)][Execute buffer]] * Tasks ** Manually transcribe @@ -802,6 +803,55 @@ Take advantage of provided scripts or autogenerated files and run [[file:subtitles/fix.py]] like this: =fix.py emacsconf-2020--04-music-in-plain-text--jonathan-gregory.sbv=. +*** Add transcript sections + +#+begin_src emacs-lisp :eval no :tangle no +(defvar conf/wiki-directory "~/vendor/emacsconf-wiki" "Directory that has the public conference wiki.") + +(defmacro conf/with-talk-info-file (talk &rest body) + "Evaluate BODY in the info file for TALK. +If TALK is not specified, do it in the current buffer." + (declare (indent 1)) + `(if ,talk + (with-current-buffer + (find-file-noselect + (expand-file-name (format "%d/info/%s.md" conf/year + (plist-get talk :talk-id)) + conf/wiki-directory)) + ,@body) + ,@body)) + +(defun conf/add-transcript (&optional talk) + "Try to add transcript for the current talk." + (interactive) + (conf/with-talk-info-file talk + (goto-char (point-min)) + (let (subtitles subed-auto-find-video all) + (while (re-search-forward "subtitles=\"/\\(.+?\\)\"" nil t) + (setq subtitles (cons (match-string 1 subtitles) subtitles))) + (when subtitles + (mapc + (lambda (subtitle-file) + (with-current-buffer (find-file-noselect (expand-file-name subtitle-file conf/wiki-directory)) + (goto-char (point-min)) + (subed-mode) + (let (text) + (while (subed-forward-subtitle-text) + (setq text (cons (subed-subtitle-text) text))) + (setq all (mapconcat 'identity (reverse text) "\n")))) + (if (re-search-forward (format "[ \t]*\n\\([.\r\n]*?\\)" (regexp-quote subtitle-file)) nil t) + (progn + (goto-char (match-beginning 1)) + (delete-region (match-beginning 1) (match-end 1))) + (goto-char (point-max)) + (insert (format "\n\n\n\n" subtitle-file)) + (save-excursion (insert "\n\n\n"))) + (save-excursion (insert all))) + (reverse subtitles)))))) + +;; (conf/add-transcript (conf/find-talk "03")) + +#+end_src * Other useful tidbits ** Restarting ikiwiki manually -- cgit v1.2.3