From 014312de7356d64a481e351b31411ea822c6acbb Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Fri, 17 Dec 2021 00:51:42 -0500 Subject: handle compressed56, export to CSV --- emacsconf-subed.el | 46 ++-------------------------------------------- 1 file changed, 2 insertions(+), 44 deletions(-) (limited to 'emacsconf-subed.el') 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 -- cgit v1.2.3