summaryrefslogtreecommitdiffstats
path: root/2020/organizers-notebook.org
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2020-12-20 00:26:59 -0500
committerSacha Chua <sacha@sachachua.com>2020-12-20 00:26:59 -0500
commitbfb6755059e69e1f48eb08f9e791fce132fdf59f (patch)
treea7253549126036dc9f8a67a87435f8bec1755e86 /2020/organizers-notebook.org
parentb287660968279dfcebbcfedfbc29f842742c93bf (diff)
downloademacsconf-wiki-bfb6755059e69e1f48eb08f9e791fce132fdf59f.tar.xz
emacsconf-wiki-bfb6755059e69e1f48eb08f9e791fce132fdf59f.zip
Add transcript for 04
Diffstat (limited to '2020/organizers-notebook.org')
-rw-r--r--2020/organizers-notebook.org52
1 files changed, 51 insertions, 1 deletions
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 "<!-- transcript: %s -->[ \t]*\n\\([.\r\n]*?\\)<!-- /transcript -->" (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<!-- transcript: %s -->\n\n" subtitle-file))
+ (save-excursion (insert "\n\n<!-- /transcript -->\n")))
+ (save-excursion (insert all)))
+ (reverse subtitles))))))
+
+;; (conf/add-transcript (conf/find-talk "03"))
+
+#+end_src
* Other useful tidbits
** Restarting ikiwiki manually