summaryrefslogtreecommitdiffstats
path: root/emacsconf-subed.el
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2021-12-17 00:51:42 -0500
committerSacha Chua <sacha@sachachua.com>2021-12-17 00:51:42 -0500
commit014312de7356d64a481e351b31411ea822c6acbb (patch)
tree0f109058b81b5e392765bbc6a1fab21ca1361ed3 /emacsconf-subed.el
parentba37c841dfbe8bec8e303055a40a6bc30c6cab57 (diff)
downloademacsconf-el-014312de7356d64a481e351b31411ea822c6acbb.tar.xz
emacsconf-el-014312de7356d64a481e351b31411ea822c6acbb.zip
handle compressed56, export to CSV
Diffstat (limited to 'emacsconf-subed.el')
-rw-r--r--emacsconf-subed.el46
1 files changed, 2 insertions, 44 deletions
diff --git a/emacsconf-subed.el b/emacsconf-subed.el
index 899f3a0..efddcb8 100644
--- a/emacsconf-subed.el
+++ b/emacsconf-subed.el
@@ -99,7 +99,8 @@
(wiki-file (plist-get info :wiki-file-path))
(caption-file (expand-file-name (concat (plist-get info :video-slug) "--main.vtt")
emacsconf-captions-directory))
- (chapters (emacsconf-subed-chapters-as-list info)))
+ (chapters (with-current-buffer (find-file-noselect caption-file)
+ (subed-subtitle-list))))
(with-temp-file wiki-file
(insert
(with-current-buffer (find-file-noselect caption-file)
@@ -172,48 +173,5 @@ Create it if necessary."
(error "Duration %d is less than minimum" (- (subed-subtitle-msecs-stop) (subed-subtitle-msecs-start))))
(or (subed-forward-subtitle-text) (goto-char (point-max)))))
-(defun emacsconf-subed-chapters-as-list (info)
- (when (file-exists-p (expand-file-name (concat (plist-get info :video-slug) "--main--chapters.vtt")
- emacsconf-captions-directory))
- (with-current-buffer (find-file-noselect (expand-file-name (concat (plist-get info :video-slug) "--main--chapters.vtt")
- emacsconf-captions-directory))
- (let (result)
- (subed-for-each-subtitle (point-min) (point-max) nil
- (setq result
- (cons
- (cons (subed-subtitle-msecs-start)
- (subed-subtitle-text))
- result)))
- (nreverse result)))))
-
-(defun emacsconf-subed-chapters-buffer-as-list ()
- (let (result)
- (subed-for-each-subtitle (point-min) (point-max) nil
- (setq result
- (cons
- (list
- :text
- (subed-subtitle-text)
- :start-ms
- (subed-subtitle-msecs-start)
- :stop-ms
- (subed-subtitle-msecs-stop))
- result)))
- (nreverse result)))
-
-(defun emacsconf-subed-chapters-as-description ()
- (interactive)
- (let ((result
- (mapconcat
- (lambda (o)
- (concat (format-seconds "%.2m:%.2s" (/ (plist-get o :start-ms) 1000))
- " "
- (plist-get o :text)))
- (emacsconf-subed-chapters-buffer-as-list)
- "\n")))
- (when (called-interactively-p 'any)
- (kill-new result))
- result))
-
(provide 'emacsconf-subed)
;;; emacsconf-subed.el ends here