diff options
author | Sacha Chua <sacha@sachachua.com> | 2022-10-23 08:13:31 -0400 |
---|---|---|
committer | Sacha Chua <sacha@sachachua.com> | 2022-10-23 08:13:31 -0400 |
commit | d3a178bda7d74a2cdc10c9091d26f2a4ce75ca37 (patch) | |
tree | d869f2fd91b40543cefc17e26b80d9f5219c319d | |
parent | 093497894b84bcea46c2df7b5d360261b881693e (diff) | |
download | emacsconf-el-d3a178bda7d74a2cdc10c9091d26f2a4ce75ca37.tar.xz emacsconf-el-d3a178bda7d74a2cdc10c9091d26f2a4ce75ca37.zip |
Caption-related backstage tweaks
-rw-r--r-- | emacsconf-publish.el | 39 | ||||
-rw-r--r-- | emacsconf.el | 16 |
2 files changed, 33 insertions, 22 deletions
diff --git a/emacsconf-publish.el b/emacsconf-publish.el index b7a6073..d254468 100644 --- a/emacsconf-publish.el +++ b/emacsconf-publish.el @@ -143,10 +143,11 @@ "<div class=\"vid\">${video-html}${resources}${extra}${chapter-list}</div>")))) (defun emacsconf-index-card-video (video-id video-file talk extensions &optional backstage) - (let* ((chapter-info (and video-file + (let* ((video-base (file-name-base (replace-regexp-in-string "--\\(normalized\\|reencoded\\)" "--main" video-file))) + (chapter-info (and video-file (emacsconf-make-chapter-strings (expand-file-name - (concat (file-name-base video-file) "--chapters.vtt") + (concat video-base "--chapters.vtt") emacsconf-cache-dir) (plist-get talk :track-base-url)))) (info @@ -162,7 +163,8 @@ (and video-file (let ((tracks (emacsconf-video-subtitle-tracks - (expand-file-name (concat (file-name-base video-file) ".vtt") emacsconf-cache-dir) + (expand-file-name + (concat video-base ".vtt") emacsconf-cache-dir) (or (plist-get talk :track-base-url) (plist-get talk :base-url))))) (cond @@ -773,18 +775,18 @@ Entries are sorted chronologically, with different tracks interleaved." (if (plist-get f :caption-note) (concat "<div class=\"caption-note\">" (plist-get f :caption-note) "</div>") "") :files (emacsconf-publish-talk-files f files)))) - (format "<li><strong>%s</strong><br />%s<br />%s<br/ ><a href=\"%s%s\">View talk page</a></li>" + (format "<li><strong><a href=\"%s%s\">%s</a></strong><br />%s<br />%s</li>" + emacsconf-base-url + (plist-get f :url) (plist-get f :title) (plist-get f :speakers) - (emacsconf-index-card f) - emacsconf-base-url - (plist-get f :url))) + (emacsconf-index-card f))) list "\n"))) (format "<h1>%d talk(s) being captioned (%s minutes)</h1><ul>%s</ul>" (length (assoc-default "TO_CAPTION" by-status)) - (apply '+ (seq-map (lambda (talk) (string-to-number (plist-get talk :duration))) (assoc-default "TO_CAPTION" by-status))) + (emacsconf-sum :video-time (assoc-default "TO_CAPTION" by-status)) (mapconcat (lambda (f) (setq f (append @@ -793,22 +795,25 @@ Entries are sorted chronologically, with different tracks interleaved." (if (plist-get f :captioner) (concat "<div class=\"caption-note\">" (plist-get f :captioner) "</div>") "") :files (emacsconf-publish-talk-files f files)))) - (format "<li><strong>%s</strong><br />%s<br />%s<br/ ><a href=\"%s%s\">View talk page</a></li>" + (format "<li><strong><a href=\"%s%s\">%s</a></strong><br />%s<br />%s</li>" + emacsconf-base-url + (plist-get f :url) (plist-get f :title) (plist-get f :speakers) - (emacsconf-index-card f) - emacsconf-base-url - (plist-get f :url))) + (emacsconf-index-card f))) (assoc-default "TO_CAPTION" by-status) "\n")) (format "<h1>%d captioned talk(s) ready for enjoyment (%d minutes)</h1><ol class=\"videos\">%s</ol>" (length (assoc-default "TO_STREAM" by-status)) - (apply '+ (seq-map (lambda (talk) (string-to-number (plist-get talk :duration))) (assoc-default "TO_STREAM" by-status))) - (mapconcat (lambda (f) (format "<li><strong>%s</strong><br />%s<br />%s</li>" - (plist-get f :title) - (plist-get f :speakers) - (emacsconf-index-card f emacsconf-main-extensions))) + (emacsconf-sum :video-time (assoc-default "TO_STREAM" by-status)) + (mapconcat (lambda (f) + (format "<li><strong><a href=\"%s%s\">%s</a></strong><br />%s<br />%s</li>" + emacsconf-base-url + (plist-get f :url) + (plist-get f :title) + (plist-get f :speakers) + (emacsconf-index-card (append f (list :extra (concat "Captioned by " (plist-get f :captioner)))) emacsconf-main-extensions))) (assoc-default "TO_STREAM" by-status) "\n")) (if (file-exists-p (expand-file-name "include-in-index.html" emacsconf-captions-directory)) (with-temp-buffer (insert-file-contents (expand-file-name "include-in-index.html" emacsconf-captions-directory)) (buffer-string)) diff --git a/emacsconf.el b/emacsconf.el index f2c5e96..e036258 100644 --- a/emacsconf.el +++ b/emacsconf.el @@ -133,11 +133,16 @@ (emacsconf-upload-to-backstage-and-rename talk "main"))))) (defun emacsconf-upload-to-backstage-and-rename (talk filename) - (interactive (list (emacsconf-complete-talk-info) - (read-string (format "Filename (%s): " - (file-name-base (buffer-file-name))) - nil nil - (file-name-base (buffer-file-name))))) + (interactive (let ((talk (emacsconf-complete-talk-info)) + (base (file-name-base (buffer-file-name)))) + (list + talk + (if (string-match (concat "^" (regexp-quote (plist-get talk :video-slug)) "--\\([a-z]+\\)") + base) + (match-string 1 base) + (read-string (format "Filename (%s): " base) + nil nil + base))))) (copy-file (buffer-file-name) (expand-file-name (concat (plist-get talk :video-slug) "--" @@ -146,6 +151,7 @@ (file-name-extension (buffer-file-name))) emacsconf-backstage-dir) t)) + (defun emacsconf-upload-copy-from-json (talk key filename) (interactive (let-alist (json-parse-string (buffer-string) :object-type 'alist) (list (emacsconf-complete-talk-info) |