summaryrefslogtreecommitdiffstats
path: root/2020
diff options
context:
space:
mode:
Diffstat (limited to '2020')
-rw-r--r--2020/organizers-notebook.org53
1 files changed, 15 insertions, 38 deletions
diff --git a/2020/organizers-notebook.org b/2020/organizers-notebook.org
index 89792aab..1eb742dd 100644
--- a/2020/organizers-notebook.org
+++ b/2020/organizers-notebook.org
@@ -823,44 +823,21 @@ If TALK is not specified, do it in the current buffer."
,@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))
- (when (re-search-forward "^$\\|\\[View transcript" nil t)
- (unless (string= (match-string 0) "[View transcript")
- (insert
- (if (string-match "questions" (car subtitles))
- "[View transcript for Q&A](#transcript-questions)\n"
- "[View transcript](#transcript)\n")))))
- (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))
- (insert (if (string-match "questions" subtitle-file)
- "<a name=\"transcript-questions\"></a>\n# Transcript: Q&A\n\n"
- "<a name=\"transcript\"></a>\n# Transcript\n\n"))
- (save-excursion (insert "\n\n<!-- /transcript -->\n")))
- (save-excursion (insert all)))
- (reverse subtitles))))))
-
-;; (conf/add-transcript (conf/find-talk "03")), or call from a talk info page
+(defun my/convert-transcript-to-directives (id)
+ (interactive "MID: ")
+ (goto-char (point-min))
+ (kill-new
+ (concat
+ "<a name=\"transcript\"></a>\n# Transcript\n\n"
+ (cl-loop while (subed-forward-subtitle-text)
+ concat (format "[[!template text=\"%s\" start=\"%s\" video=\"%s\" id=subtitle]]\n"
+ (replace-regexp-in-string
+ "\n" " "
+ (replace-regexp-in-string
+ "\"" "&quot;"
+ (replace-regexp-in-string "[][]" "" (subed-subtitle-text))))
+ (subed-vtt--msecs-to-timestamp (subed-subtitle-msecs-start))
+ id)))))
#+end_src
* Other useful tidbits