diff options
author | Sacha Chua <sacha@sachachua.com> | 2022-11-04 19:00:50 -0400 |
---|---|---|
committer | Sacha Chua <sacha@sachachua.com> | 2022-11-04 19:00:50 -0400 |
commit | 67d7aac3235f3fba73b82e1f7d2660fbb59e44dd (patch) | |
tree | 8f13361fb72e87d45c88d77fad397070152cdf21 | |
parent | dfbbf5d6078020b511f9c0104d2f056fa5769f38 (diff) | |
download | emacsconf-el-67d7aac3235f3fba73b82e1f7d2660fbb59e44dd.tar.xz emacsconf-el-67d7aac3235f3fba73b82e1f7d2660fbb59e44dd.zip |
Convenience functions for working with subtitles
Diffstat (limited to '')
-rw-r--r-- | emacsconf-publish.el | 4 | ||||
-rw-r--r-- | emacsconf-subed.el | 4 | ||||
-rw-r--r-- | emacsconf.el | 17 |
3 files changed, 12 insertions, 13 deletions
diff --git a/emacsconf-publish.el b/emacsconf-publish.el index d4d8405..a90803b 100644 --- a/emacsconf-publish.el +++ b/emacsconf-publish.el @@ -1303,8 +1303,8 @@ Entries are sorted chronologically, with different tracks interleaved." duration) (unless (file-exists-p main) (setq main video-file-name)) - (org-entry-put (point) "VIDEO_FILE" (file-name-nondirectory main)) - (org-entry-put (point) "VIDEO_FILE_SIZE" (file-size-human-readable (file-attribute-size (file-attributes main)))) + (org-entry-put (point) "VIDEO_FILE" (file-name-nondirectory video-file)) + (org-entry-put (point) "VIDEO_FILE_SIZE" (file-size-human-readable (file-attribute-size (file-attributes video-file)))) (unless (plist-get talk :video-time) (setq duration (/ (compile-media-get-file-duration-ms video-file) 1000)) (org-entry-put (point) "VIDEO_DURATION" (format-seconds "%m:%.2s" duration)) diff --git a/emacsconf-subed.el b/emacsconf-subed.el index 93542ac..9aca0e0 100644 --- a/emacsconf-subed.el +++ b/emacsconf-subed.el @@ -149,15 +149,15 @@ "Open the caption file for this talk. Create it if necessary." (interactive) - (require 'compile-media) (let ((video-slug (org-entry-get (point) "VIDEO_SLUG"))) (find-file - (or (car (directory-files emacsconf-captions-directory + (or (car (directory-files emacsconf-cache-dir t (concat (regexp-quote video-slug) "--main\\.\\(srt\\|vtt\\)"))) (expand-file-name (concat video-slug "--main.vtt") "captions"))) (when (eobp) + (require 'compile-media) (insert "WEBVTT\n\n0:00:00.000 --> " (compile-media-msecs-to-timestamp (compile-media-get-file-duration-ms (subed-guess-video-file))) diff --git a/emacsconf.el b/emacsconf.el index 4b6b444..ac7a4aa 100644 --- a/emacsconf.el +++ b/emacsconf.el @@ -169,10 +169,7 @@ (interactive (let-alist (json-parse-string (buffer-string) :object-type 'alist) (list (emacsconf-complete-talk-info) .metadata.key - (read-string (format "Filename (%s): " - (file-name-base .metadata.name)) - nil nil - (file-name-base .metadata.name))))) + (read-string (format "Filename: "))))) (let ((new-filename (concat (plist-get talk :video-slug) (if (string= filename "") filename @@ -183,10 +180,12 @@ (copy-file key (expand-file-name new-filename emacsconf-backstage-dir) t) - (copy-file key (expand-file-name new-filename emacsconf-cache-dir)) - (unless (file-directory-p (expand-file-name (plist-get talk :slug) emacsconf-res-dir)) - (make-directory (expand-file-name (plist-get talk :slug) emacsconf-res-dir))) - (copy-file (expand-file-name new-filename emacsconf-cache-dir) (expand-file-name new-filename (expand-file-name (plist-get talk :slug) emacsconf-res-dir))))) + ;; (copy-file key (expand-file-name new-filename emacsconf-cache-dir)) + ;; (unless (file-directory-p (expand-file-name (plist-get talk :slug) emacsconf-res-dir)) + ;; (make-directory (expand-file-name (plist-get talk :slug) emacsconf-res-dir))) + ;; (copy-file (expand-file-name new-filename emacsconf-cache-dir) + ;; (expand-file-name new-filename (expand-file-name (plist-get talk :slug) emacsconf-res-dir))) + )) (defcustom emacsconf-download-directory "~/Downloads" "Directory to check for downloaded files." @@ -199,7 +198,7 @@ (defun emacsconf-find-captions-from-slug (search) (interactive (list (emacsconf-complete-talk))) - (emacsconf-with-talk-heading search (emacsconf-find-captions))) + (emacsconf-with-talk-heading search (emacsconf-subed-find-captions))) (defun emacsconf-edit-wiki-page (search) (interactive (list (emacsconf-complete-talk))) |