diff options
author | Sacha Chua <sacha@sachachua.com> | 2023-10-10 10:14:48 -0400 |
---|---|---|
committer | Sacha Chua <sacha@sachachua.com> | 2023-10-10 10:14:48 -0400 |
commit | d8881dbc1333a68644b5d9808a7471ba9ab25194 (patch) | |
tree | 2de0783b82e5fa08176ea29f5cfd1509830813a0 | |
parent | 50879322aaaf5ac53b5fdeeb15aaf7cb53fea485 (diff) | |
download | emacsconf-el-d8881dbc1333a68644b5d9808a7471ba9ab25194.tar.xz emacsconf-el-d8881dbc1333a68644b5d9808a7471ba9ab25194.zip |
rename VIDEO_SLUG to FILE_PREFIX
-rw-r--r-- | emacsconf-extract.el | 30 | ||||
-rw-r--r-- | emacsconf-mail.el | 6 | ||||
-rw-r--r-- | emacsconf-pad.el | 6 | ||||
-rw-r--r-- | emacsconf-publish.el | 92 | ||||
-rw-r--r-- | emacsconf-stream.el | 10 | ||||
-rw-r--r-- | emacsconf-subed.el | 22 | ||||
-rw-r--r-- | emacsconf.el | 36 |
7 files changed, 101 insertions, 101 deletions
diff --git a/emacsconf-extract.el b/emacsconf-extract.el index 6f5f6b1..55519f4 100644 --- a/emacsconf-extract.el +++ b/emacsconf-extract.el @@ -62,7 +62,7 @@ (let ((recording-start (/ (string-to-number (dom-text (dom-by-tag metadata 'start_time))) 1000))) - (with-temp-file (expand-file-name (concat (plist-get o :video-slug) "--extract.txt") + (with-temp-file (expand-file-name (concat (plist-get o :file-prefix) "--extract.txt") emacsconf-cache-dir) (insert (mapconcat @@ -89,9 +89,9 @@ (expand-file-name "bbb-playbacks" emacsconf-cache-dir)))) (mapc (lambda (file) (when (and (file-exists-p (expand-file-name file playback-dir)) - (not (file-exists-p (expand-file-name (concat (plist-get o :video-slug) "--bbb-" file) emacsconf-cache-dir)))) + (not (file-exists-p (expand-file-name (concat (plist-get o :file-prefix) "--bbb-" file) emacsconf-cache-dir)))) (copy-file (expand-file-name file playback-dir) - (expand-file-name (concat (plist-get o :video-slug) "--bbb-" file) emacsconf-cache-dir) + (expand-file-name (concat (plist-get o :file-prefix) "--bbb-" file) emacsconf-cache-dir) t))) '("webcams.webm" "metadata.xml" "deskshare.webm" "deskshare.xml" "slides_new.xml" "webcams.opus")))) (or info (emacsconf-prepare-for-display (emacsconf-get-talk-info))))) @@ -330,7 +330,7 @@ (match-string 1 (plist-get o :bbb-playback))))) (format "scp ~/current/bbb-raw/%s/events.xml orga@media.emacsconf.org:~/backstage/%s--bbb-events.xml\n" meeting-id - (plist-get o :video-slug))) + (plist-get o :file-prefix))) "")) (defun emacsconf-extract-bbb-voice-events (file) @@ -548,7 +548,7 @@ "-i" (expand-file-name (concat - (plist-get talk :video-slug) + (plist-get talk :file-prefix) "--bbb-deskshare.webm") emacsconf-cache-dir)) (when time (list "-to" time)) @@ -556,7 +556,7 @@ "-i" (expand-file-name (concat - (plist-get talk :video-slug) + (plist-get talk :file-prefix) "--bbb-webcams.opus") emacsconf-cache-dir)) (when time (list "-to" time)) @@ -565,7 +565,7 @@ "copy" (expand-file-name (concat - (plist-get talk :video-slug) + (plist-get talk :file-prefix) "--answers.webm") emacsconf-cache-dir))))) (time @@ -576,7 +576,7 @@ "-i" (expand-file-name (concat - (plist-get talk :video-slug) + (plist-get talk :file-prefix) "--bbb-webcams.webm") emacsconf-cache-dir)) (when time (list "-to" time)) @@ -585,19 +585,19 @@ "copy" (expand-file-name (concat - (plist-get talk :video-slug) + (plist-get talk :file-prefix) "--answers.webm") emacsconf-cache-dir))))) (t (copy-file (expand-file-name (concat - (plist-get talk :video-slug) + (plist-get talk :file-prefix) "--bbb-webcams.webm") emacsconf-cache-dir) (expand-file-name (concat - (plist-get talk :video-slug) + (plist-get talk :file-prefix) "--answers.webm") emacsconf-cache-dir) t))) @@ -609,24 +609,24 @@ (copy-file (expand-file-name (concat - (plist-get talk :video-slug) + (plist-get talk :file-prefix) "--answers." suffix) emacsconf-cache-dir) (expand-file-name (concat - (plist-get talk :video-slug) + (plist-get talk :file-prefix) "--answers." suffix) emacsconf-backstage-dir) t) (copy-file (expand-file-name (concat - (plist-get talk :video-slug) + (plist-get talk :file-prefix) "--answers." suffix) emacsconf-backstage-dir) (expand-file-name (concat - (plist-get talk :video-slug) + (plist-get talk :file-prefix) "--answers." suffix) emacsconf-public-media-directory) t)) diff --git a/emacsconf-mail.el b/emacsconf-mail.el index 5b836b6..092abb2 100644 --- a/emacsconf-mail.el +++ b/emacsconf-mail.el @@ -520,7 +520,7 @@ Include some other things, too, such as emacsconf-year, title, name, email, url, (defun emacsconf-mail-captions-for-approval (talk) (interactive (list (emacsconf-complete-talk-info))) - (let ((captions (expand-file-name (concat (plist-get talk :video-slug) "--main.vtt") + (let ((captions (expand-file-name (concat (plist-get talk :file-prefix) "--main.vtt") emacsconf-cache-dir)) (captioner-info (with-current-buffer (find-file-noselect emacsconf-org-file) @@ -548,7 +548,7 @@ Include some other things, too, such as emacsconf-year, title, name, email, url, (format "%s volunteered to edit the captions for your video. " (assoc-default "NAME_SHORT" captioner-info))) :chapters-note (if (file-exists-p - (expand-file-name (concat (plist-get talk :video-slug) "--main--chapters.vtt") + (expand-file-name (concat (plist-get talk :file-prefix) "--main--chapters.vtt") emacsconf-cache-dir)) "I've come up with some potential chapter headings which you can see as NOTE in the transcript or in the backstage entry for your video. Let me know if you want to tweak those.\n\n" "") @@ -893,7 +893,7 @@ ${signature} Limit to SUBJECT if specified." (let ((message (json-parse-string (shell-command-to-string - (format "notmuch search --limit=1 --format=json \"(%s)%s%s\"" + (format "notmuch search --limit=1 --format=json %s%s\"" (mapconcat (lambda (email) (concat "from:" (shell-quote-argument email))) (emacsconf-mail-get-all-email-addresses talk) diff --git a/emacsconf-pad.el b/emacsconf-pad.el index 243f973..152b636 100644 --- a/emacsconf-pad.el +++ b/emacsconf-pad.el @@ -794,14 +794,14 @@ This page is for easy reference and recording. Please make sure any changes here (defun emacsconf-pad-backup-talk (talk) (interactive (list (emacsconf-complete-talk-info))) - (with-temp-file (expand-file-name (concat (plist-get talk :video-slug) "--pad.html") + (with-temp-file (expand-file-name (concat (plist-get talk :file-prefix) "--pad.html") emacsconf-cache-dir) (insert (emacsconf-pad-get-html (emacsconf-pad-id talk)))) (call-process "pandoc" nil nil nil "-o" - (expand-file-name (concat (plist-get talk :video-slug) "--pad.md") + (expand-file-name (concat (plist-get talk :file-prefix) "--pad.md") emacsconf-cache-dir) - (expand-file-name (concat (plist-get talk :video-slug) "--pad.html") + (expand-file-name (concat (plist-get talk :file-prefix) "--pad.html") emacsconf-cache-dir))) (defun emacsconf-pad-backup-talks () diff --git a/emacsconf-publish.el b/emacsconf-publish.el index 4fac960..485dd84 100644 --- a/emacsconf-publish.el +++ b/emacsconf-publish.el @@ -135,9 +135,9 @@ (defun emacsconf-index-card (talk &optional extensions) "Format an HTML card for TALK, linking the files in EXTENSIONS." - (let* ((video-slug (plist-get talk :video-slug)) + (let* ((file-prefix (plist-get talk :file-prefix)) (video-file (plist-get talk :video-file)) - (video (and video-slug + (video (and file-prefix (emacsconf-index-card-video (or (plist-get talk :video-id) (concat (plist-get talk :slug) "-mainVideo")) @@ -564,9 +564,9 @@ ${pad-info}${irc-info}${status-info}${schedule-info}\n" (let ((default-directory emacsconf-directory)) (mapc (lambda (ext) - (let ((filename (expand-file-name (concat (plist-get talk :video-slug) ext) + (let ((filename (expand-file-name (concat (plist-get talk :file-prefix) ext) (expand-file-name "captions" (expand-file-name emacsconf-year emacsconf-directory)))) - (cached-file (expand-file-name (concat (plist-get talk :video-slug) ext) emacsconf-cache-dir))) + (cached-file (expand-file-name (concat (plist-get talk :file-prefix) ext) emacsconf-cache-dir))) (when (and (file-exists-p cached-file) (or (not (file-exists-p filename)) @@ -1086,7 +1086,7 @@ Entries are sorted chronologically, with different tracks interleaved." (defun emacsconf-publish-talk-files (talk files) (seq-filter (lambda (o) - (and (string-match (concat "^" (regexp-quote (plist-get talk :video-slug))) o) + (and (string-match (concat "^" (regexp-quote (plist-get talk :file-prefix))) o) (not (string= (plist-get talk :video-file) o)))) files)) @@ -1134,7 +1134,7 @@ Entries are sorted chronologically, with different tracks interleaved." (defun emacsconf-publish-backstage-to-assign (by-status files) (let ((list (assoc-default "TO_ASSIGN" by-status))) - (format "<h1>%s talk(s) to be captioned (%d minutes)</h1><p>You can e-mail <a href=\"mailto:sacha@sachachua.com\">sacha@sachachua.com</a> to call dibs on editing the captions for one of these talks. This year, we're experimenting with using OpenAI Whisper to provide auto-generated VTT that you can use as a starting point. If you're writing them from scratch, you can choose to include timing information, or we can probably figure them out afterwards with a forced alignment tool. More info: <a href=\"https://media.emacsconf.org/2022/backstage/editing-captions.html\">Editing captions</a>, <a href=\"https://emacsconf.org/captioning/\">captioning tips</a></p><ul class=\"videos\">%s</ul>" + (format "<h1>%s talk(s) to be captioned (%d minutes)</h1><p>You can e-mail <a href=\"mailto:sacha@sachachua.com\">sacha@sachachua.com</a> to call dibs on editing the captions for one of these talks. We use OpenAI Whisper to provide auto-generated VTT that you can use as a starting point, but you can also write the captions from scratch if you like. If you're writing them from scratch, you can choose to include timing information, or we can probably figure them out afterwards with a forced alignment tool. More info: <a href=\"https://emacsconf.org/captioning/\">captioning tips</a></p><ul class=\"videos\">%s</ul>" (length list) (emacsconf-sum :video-time list) (mapconcat @@ -1285,14 +1285,14 @@ answers without needing to listen to everything again. You can see <a href=\"htt (emacsconf-index-card (append (list :video-note - (unless (file-exists-p (expand-file-name (concat (plist-get f :video-slug) "--bbb-webcams.webm") emacsconf-cache-dir)) + (unless (file-exists-p (expand-file-name (concat (plist-get f :file-prefix) "--bbb-webcams.webm") emacsconf-cache-dir)) "<div>No Q&A video for this talk</div>") :video-file (cond - ((file-exists-p (expand-file-name (concat (plist-get f :video-slug) "--answers.webm") emacsconf-cache-dir)) - (concat (plist-get f :video-slug) "--answers.webm")) - ((file-exists-p (expand-file-name (concat (plist-get f :video-slug) "--bbb-webcams.webm") emacsconf-cache-dir)) - (concat (plist-get f :video-slug) "--bbb-webcams.webm")) + ((file-exists-p (expand-file-name (concat (plist-get f :file-prefix) "--answers.webm") emacsconf-cache-dir)) + (concat (plist-get f :file-prefix) "--answers.webm")) + ((file-exists-p (expand-file-name (concat (plist-get f :file-prefix) "--bbb-webcams.webm") emacsconf-cache-dir)) + (concat (plist-get f :file-prefix) "--bbb-webcams.webm")) (t t)) ;; omit video :video-id "-qanda" :extra @@ -1304,20 +1304,20 @@ answers without needing to listen to everything again. You can see <a href=\"htt (format-time-string "%Y-%m-%d" (plist-get f :start-time)) (plist-get (emacsconf-get-track f) :channel)) (emacsconf-surround ", <a href=\"" - (if (file-exists-p (expand-file-name (concat (plist-get f :video-slug) "--pad.txt") + (if (file-exists-p (expand-file-name (concat (plist-get f :file-prefix) "--pad.txt") emacsconf-cache-dir)) - (concat (plist-get f :video-slug) "--pad.txt")) + (concat (plist-get f :file-prefix) "--pad.txt")) "\">Etherpad (Markdown)</a>" "") (emacsconf-surround ", <a href=\"" (plist-get f :bbb-playback) "\">BBB playback</a>" "") (emacsconf-surround ", <a href=\"" - (if (file-exists-p (expand-file-name (concat (plist-get f :video-slug) "--bbb.txt") + (if (file-exists-p (expand-file-name (concat (plist-get f :file-prefix) "--bbb.txt") emacsconf-cache-dir)) - (concat (plist-get f :video-slug) "--bbb.txt")) + (concat (plist-get f :file-prefix) "--bbb.txt")) "\">BBB text chat</a>" "") (emacsconf-surround ", <a href=\"" - (if (file-exists-p (expand-file-name (concat (plist-get f :video-slug) "--bbb-webcams.opus") + (if (file-exists-p (expand-file-name (concat (plist-get f :file-prefix) "--bbb-webcams.opus") emacsconf-cache-dir)) - (concat (plist-get f :video-slug) "--bbb-webcams.opus")) + (concat (plist-get f :file-prefix) "--bbb-webcams.opus")) "\">BBB audio only</a>" "")) :files (emacsconf-publish-talk-files f files)) f) @@ -1331,10 +1331,10 @@ answers without needing to listen to everything again. You can see <a href=\"htt "</body></html>"))))) (defun emacsconf-publish-filter-files (talk files extensions &optional selector) - (when (plist-get talk :video-slug) + (when (plist-get talk :file-prefix) (seq-filter (lambda (f) - (string-match (concat (regexp-quote (plist-get talk :video-slug)) + (string-match (concat (regexp-quote (plist-get talk :file-prefix)) (if selector (concat "--" selector)) ".*" (regexp-opt extensions) @@ -1499,8 +1499,8 @@ answers without needing to listen to everything again. You can see <a href=\"htt emacsconf-publish-subtitle-languages ""))) -(defun emacsconf-link-file-formats (video-slug extensions) - (string-join (emacsconf-link-file-formats-as-list video-slug extensions) " ")) +(defun emacsconf-link-file-formats (file-prefix extensions) + (string-join (emacsconf-link-file-formats-as-list file-prefix extensions) " ")) (defun emacsconf-link-file-formats-as-list (talk extensions) (if (plist-get talk :files) @@ -1509,12 +1509,12 @@ answers without needing to listen to everything again. You can see <a href=\"htt (format "<a href=\"%s%s\">Download %s</a>" (or (plist-get talk :base-url) "") file - (replace-regexp-in-string (concat "^" (regexp-quote (plist-get talk :video-slug))) "" file))) + (replace-regexp-in-string (concat "^" (regexp-quote (plist-get talk :file-prefix))) "" file))) (plist-get talk :files)) - (let ((video-slug (plist-get talk :video-slug))) + (let ((file-prefix (plist-get talk :file-prefix))) (delq nil (seq-map (lambda (ext) (let ((file (expand-file-name - (concat video-slug ext) + (concat file-prefix ext) emacsconf-cache-dir)) size) (when (file-exists-p file) @@ -1524,7 +1524,7 @@ answers without needing to listen to everything again. You can see <a href=\"htt "")) (format "<a href=\"%s%s\">Download %s%s</a>" (or (plist-get talk :base-url) "") - (concat video-slug ext) + (concat file-prefix ext) ext size)))) extensions))))) @@ -1543,10 +1543,10 @@ answers without needing to listen to everything again. You can see <a href=\"htt (plist-get o :start-time) emacsconf-timezone)) (main-video (expand-file-name - (concat (plist-get o :video-slug) "--main.webm") + (concat (plist-get o :file-prefix) "--main.webm") emacsconf-cache-dir)) (qa-video (expand-file-name - (concat (plist-get o :video-slug) "--answers.webm") + (concat (plist-get o :file-prefix) "--answers.webm") emacsconf-cache-dir)) (talk-page-url (plist-get o :url)) (speakers (or (plist-get o :speakers) ""))) @@ -1562,7 +1562,7 @@ answers without needing to listen to everything again. You can see <a href=\"htt (format "%s%s/%s--main.webm" emacsconf-media-base-url (plist-get o :conf-year) - (plist-get o :video-slug)) + (plist-get o :file-prefix)) date (format-seconds "%02h:%z%02m:%02s" (/ (compile-media-get-file-duration-ms main-video) 1000)) (if (file-exists-p main-video) @@ -1580,7 +1580,7 @@ answers without needing to listen to everything again. You can see <a href=\"htt (format "%s%s/%s--answers.webm" emacsconf-media-base-url (plist-get o :conf-year) - (plist-get o :video-slug)) + (plist-get o :file-prefix)) date (format-seconds "%02h:%z%02m:%02s" (/ (compile-media-get-file-duration-ms qa-video) 1000)) (if (file-exists-p qa-video) @@ -1693,26 +1693,26 @@ answers without needing to listen to everything again. You can see <a href=\"htt talks ""))))) -(defun emacsconf-get-preferred-video (video-slug &optional files) +(defun emacsconf-get-preferred-video (file-prefix &optional files) (or (car (mapcar (lambda (suffix) (seq-find (lambda (s) (string-match (concat (regexp-quote - (if suffix (concat video-slug "--" suffix) - video-slug)) + (if suffix (concat file-prefix "--" suffix) + file-prefix)) "\\." (regexp-opt emacsconf-media-extensions)) s)) files)) '("main" "captioned" "normalized" "reencoded" "compressed" "original" nil))) (seq-find 'file-exists-p (seq-map (lambda (suffix) - (expand-file-name (concat video-slug "--" suffix ".webm") + (expand-file-name (concat file-prefix "--" suffix ".webm") emacsconf-cache-dir)) '("main" "captioned" "normalized" "reencoded" "compressed" "original"))) (car (directory-files emacsconf-cache-dir nil - (concat (regexp-quote video-slug) + (concat (regexp-quote file-prefix) ".*\\." (regexp-opt emacsconf-media-extensions)))))) @@ -1731,7 +1731,7 @@ answers without needing to listen to everything again. You can see <a href=\"htt (shell-quote-argument filename))) "\n")) (delq nil - (mapcar (lambda (talk) (emacsconf-get-preferred-video (plist-get talk :video-slug))) + (mapcar (lambda (talk) (emacsconf-get-preferred-video (plist-get talk :file-prefix))) emacsconf-info))) (switch-to-buffer (current-buffer)))) @@ -1743,7 +1743,7 @@ answers without needing to listen to everything again. You can see <a href=\"htt (let ((chapters (subed-parse-file (expand-file-name (concat - (file-name-base (plist-get talk :video-slug)) "--main--chapters.vtt") + (file-name-base (plist-get talk :file-prefix)) "--main--chapters.vtt") emacsconf-cache-dir))) result) (setq result @@ -1780,7 +1780,7 @@ This video is available under the terms of the Creative Commons Attribution-Shar (interactive (list current-prefix-arg)) (mapc (lambda (talk) - (when (and (plist-get talk :video-slug) + (when (and (plist-get talk :file-prefix) (or force (null (plist-get talk :video-file-size)))) (emacsconf-publish-cache-video-data talk))) (emacsconf-get-talk-info))) @@ -1789,10 +1789,10 @@ This video is available under the terms of the Creative Commons Attribution-Shar (defun emacsconf-publish-cache-video-data (talk) (interactive (list (emacsconf-complete-talk-info))) - (let ((main (expand-file-name (concat (plist-get talk :video-slug) "--main.webm") + (let ((main (expand-file-name (concat (plist-get talk :file-prefix) "--main.webm") emacsconf-cache-dir))) (emacsconf-with-talk-heading talk - (let* ((video-file-name (emacsconf-get-preferred-video (plist-get talk :video-slug))) + (let* ((video-file-name (emacsconf-get-preferred-video (plist-get talk :file-prefix))) (video-file (and video-file-name (expand-file-name video-file-name emacsconf-cache-dir))) (qa-file (emacsconf-talk-file talk "--answers.webm")) (intro-file (expand-file-name (concat (plist-get talk :slug) ".webm") @@ -1805,7 +1805,7 @@ This video is available under the terms of the Creative Commons Attribution-Shar (org-entry-put (point) "VIDEO_FILE_SIZE" (file-size-human-readable (file-attribute-size (file-attributes video-file)))) (unless (plist-get talk :captions-edited) (let ((caption-file (expand-file-name - (concat (plist-get talk :video-slug) + (concat (plist-get talk :file-prefix) "--main.vtt") emacsconf-cache-dir))) (when (emacsconf-captions-edited-p caption-file) @@ -1846,14 +1846,14 @@ This video is available under the terms of the Creative Commons Attribution-Shar (if url (when (string-match "/w/\\([A-Za-z0-9]+\\)" url) (browse-url (format "https://toobnix.org/videos/update/%s" (match-string 1 url)))) - (when (> (length (org-entry-get (point) "VIDEO_SLUG")) 80) - (copy-file (expand-file-name (concat (org-entry-get (point) "VIDEO_SLUG") "--main.webm") emacsconf-cache-dir) + (when (> (length (org-entry-get (point) "FILE_PREFIX")) 80) + (copy-file (expand-file-name (concat (org-entry-get (point) "FILE_PREFIX") "--main.webm") emacsconf-cache-dir) (expand-file-name (concat "emacsconf-" emacsconf-year "-" (org-entry-get (point) "SLUG") ".webm") emacsconf-cache-dir) t)) (browse-url "https://toobnix.org/videos/upload#upload")))) (defun emacsconf-publish-files () (interactive) - (let* ((slug (org-entry-get (point) "VIDEO_SLUG")) + (let* ((slug (org-entry-get (point) "FILE_PREFIX")) (video-file (emacsconf-get-preferred-video slug)) (wiki-captions-directory (expand-file-name "captions" (expand-file-name emacsconf-year emacsconf-directory)))) (org-entry-put (point) "PUBLIC" "1") @@ -2224,7 +2224,7 @@ There is no live Q&A room for ${title}. You can find more information about the ;; Copy main extension files from backstage to public (let ((files (directory-files emacsconf-backstage-dir nil (concat "^" - (regexp-quote (plist-get talk :video-slug)) + (regexp-quote (plist-get talk :file-prefix)) (regexp-opt emacsconf-main-extensions))))) (mapc (lambda (file) (when (or (not (string-match "--main.vtt$" file)) @@ -2235,7 +2235,7 @@ There is no live Q&A room for ${title}. You can find more information about the ;; Remove files from public (let ((files (directory-files emacsconf-public-media-directory nil (concat "^" - (regexp-quote (plist-get talk :video-slug) + (regexp-quote (plist-get talk :file-prefix) ))))) (mapc (lambda (file) (delete-file (expand-file-name file emacsconf-public-media-directory))) @@ -2265,7 +2265,7 @@ There is no live Q&A room for ${title}. You can find more information about the (emacsconf-replace-plist-in-string (append (list :conf-name emacsconf-name :year emacsconf-year :chapters - (let ((chapters (subed-parse-file (expand-file-name (concat (plist-get talk :video-slug) "--main--chapters.vtt") emacsconf-cache-dir)))) + (let ((chapters (subed-parse-file (expand-file-name (concat (plist-get talk :file-prefix) "--main--chapters.vtt") emacsconf-cache-dir)))) (if chapters (concat (mapconcat (lambda (chapter) diff --git a/emacsconf-stream.el b/emacsconf-stream.el index 4c23d0b..774c83c 100644 --- a/emacsconf-stream.el +++ b/emacsconf-stream.el @@ -26,7 +26,7 @@ (defvar emacsconf-stream-dir "/data/emacsconf/stream/" "Directory where the stream versions are. -Files should be in YEAR/video-slug--main.webm and video-slug--main.vtt.") +Files should be in YEAR/file-prefix--main.webm and file-prefix--main.vtt.") (defvar emacsconf-stream-host "res.emacsconf.org") (defun emacsconf-stream-track-login (track) @@ -253,9 +253,9 @@ especially when two things need to happen close together." (defun emacsconf-stream-get-filename (talk) "Return the local filename for the video file for TALK. -Final files should be stored in /data/emacsconf/stream/YEAR/video-slug--main.webm." +Final files should be stored in /data/emacsconf/stream/YEAR/file-prefix--main.webm." (expand-file-name - (concat (plist-get talk :video-slug) "--main.webm") + (concat (plist-get talk :file-prefix) "--main.webm") (expand-file-name emacsconf-year emacsconf-stream-dir))) @@ -550,7 +550,7 @@ With a prefix argument (\\[universal-argument]), clear the overlay." (subtitle-len 1)) (unless (file-directory-p dir) (make-directory dir t)) (mapc (lambda (talk) - (with-temp-file (expand-file-name (concat (plist-get talk :video-slug) "--main.vtt") + (with-temp-file (expand-file-name (concat (plist-get talk :file-prefix) "--main.vtt") dir) (insert "WEBVTT\n\n" (cl-loop @@ -575,7 +575,7 @@ With a prefix argument (\\[universal-argument]), clear the overlay." (unless (file-directory-p dir) (make-directory dir t)) (mapc (lambda (talk) (add-name-to-file (expand-file-name "template.webm" dir) - (expand-file-name (concat (plist-get talk :video-slug) "--main.webm") dir) + (expand-file-name (concat (plist-get talk :file-prefix) "--main.webm") dir) t)) info))) diff --git a/emacsconf-subed.el b/emacsconf-subed.el index 0e35a61..f82e557 100644 --- a/emacsconf-subed.el +++ b/emacsconf-subed.el @@ -217,7 +217,7 @@ TYPE can be 'end if you want the match end instead of the beginning." (interactive) (let* ((info (emacsconf-get-talk-info-for-subtree)) (wiki-file (plist-get info :wiki-file-path)) - (caption-file (expand-file-name (concat (plist-get info :video-slug) "--main.vtt") + (caption-file (expand-file-name (concat (plist-get info :file-prefix) "--main.vtt") emacsconf-captions-directory)) (chapters (with-current-buffer (find-file-noselect caption-file) (subed-subtitle-list)))) @@ -227,20 +227,20 @@ TYPE can be 'end if you want the match end instead of the beginning." (emacsconf-subed-convert-transcript-to-directives "mainVideo" chapters)))) (find-file wiki-file))) -(defun emacsconf-subed-download-captions (&optional youtube-url video-slug) - (interactive (list (org-entry-get (point) "YOUTUBE_URL") (org-entry-get (point) "VIDEO_SLUG"))) +(defun emacsconf-subed-download-captions (&optional youtube-url file-prefix) + (interactive (list (org-entry-get (point) "YOUTUBE_URL") (org-entry-get (point) "FILE_PREFIX"))) (shell-command (mapconcat (lambda (f) (format "youtube-dl --write-sub --write-auto-sub --no-warnings --sub-lang en --skip-download --sub-format %s %s -o %s" f youtube-url - (expand-file-name video-slug emacsconf-captions-directory))) + (expand-file-name file-prefix emacsconf-captions-directory))) '("vtt" "srv2") ";"))) -(defun emacsconf-subed--copy-downloaded-captions-base (video-slug url type) - (let ((new-file (expand-file-name (concat video-slug "--" type ".ass") emacsconf-captions-directory))) +(defun emacsconf-subed--copy-downloaded-captions-base (file-prefix url type) + (let ((new-file (expand-file-name (concat file-prefix "--" type ".ass") emacsconf-captions-directory))) (call-process "ffmpeg" nil nil nil "-y" "-i" (emacsconf-latest-file emacsconf-download-directory "srt$") new-file) (emacsconf-subed-download-captions url new-file) @@ -253,7 +253,7 @@ TYPE can be 'end if you want the match end instead of the beginning." "Copy the most recently downloaded captions for this entry's main talk." (interactive) (emacsconf-subed--copy-downloaded-captions-base - (org-entry-get (point) "VIDEO_SLUG") + (org-entry-get (point) "FILE_PREFIX") (org-entry-get (point) "YOUTUBE_URL") "main")) @@ -261,7 +261,7 @@ TYPE can be 'end if you want the match end instead of the beginning." "Copy the most recently downloaded captions for this entry's Q&A" (interactive) (emacsconf-subed--copy-downloaded-captions-base - (org-entry-get (point) "VIDEO_SLUG") + (org-entry-get (point) "FILE_PREFIX") (org-entry-get (point) "QA_YOUTUBE") "answers")) @@ -269,13 +269,13 @@ TYPE can be 'end if you want the match end instead of the beginning." "Open the caption file for this talk. Create it if necessary." (interactive) - (let ((video-slug (org-entry-get (point) "VIDEO_SLUG"))) + (let ((file-prefix (org-entry-get (point) "FILE_PREFIX"))) (find-file (or (car (directory-files emacsconf-cache-dir t - (concat (regexp-quote video-slug) + (concat (regexp-quote file-prefix) "--main\\.\\(srt\\|vtt\\)"))) - (expand-file-name (concat video-slug "--main.vtt") "captions"))) + (expand-file-name (concat file-prefix "--main.vtt") "captions"))) (when (eobp) (require 'compile-media) (insert "WEBVTT\n\n0:00:00.000 --> " diff --git a/emacsconf.el b/emacsconf.el index d89f9b8..372e9d8 100644 --- a/emacsconf.el +++ b/emacsconf.el @@ -153,7 +153,7 @@ (defun emacsconf-slugify (s) (replace-regexp-in-string " +" "-" (replace-regexp-in-string "[^a-z0-9 ]" "" (downcase s)))) -(defun emacsconf-video-slug (talk) +(defun emacsconf-file-prefix (talk) (concat "emacsconf-" emacsconf-year "-" (plist-get talk :slug) "--" (emacsconf-slugify (plist-get talk :title)) (if (plist-get talk :speakers) @@ -163,23 +163,23 @@ -(defun emacsconf-set-video-slug-if-needed (o) +(defun emacsconf-set-file-prefix-if-needed (o) (interactive (list (emacsconf-complete-talk-info))) - (unless (plist-get o :video-slug) - (let ((video-slug - (read-string "Set video slug: " (emacsconf-video-slug o)))) + (unless (plist-get o :file-prefix) + (let ((file-prefix + (read-string "Set video slug: " (emacsconf-file-prefix o)))) (save-window-excursion (emacsconf-with-talk-heading (plist-get o :slug) - (org-entry-put (point) "VIDEO_SLUG" video-slug))) - (plist-put o :video-slug video-slug))) - (plist-get o :video-slug)) + (org-entry-put (point) "FILE_PREFIX" file-prefix))) + (plist-put o :file-prefix file-prefix))) + (plist-get o :file-prefix)) -(defun emacsconf-set-video-slugs () +(defun emacsconf-set-file-prefixes () (interactive) (org-map-entries (lambda () - (org-entry-put (point) "VIDEO_SLUG" (emacsconf-video-slug (emacsconf-get-talk-info-for-subtree)))) - "SLUG={.}-VIDEO_SLUG={.}")) + (org-entry-put (point) "FILE_PREFIX" (emacsconf-file-prefix (emacsconf-get-talk-info-for-subtree)))) + "SLUG={.}-FILE_PREFIX={.}")) (defun emacsconf-upload-to-backstage () (interactive) @@ -211,7 +211,7 @@ (mapc (lambda (file) (let ((new-file (or filename (read-string (format "Filename (%s): " (file-name-base file)))))) (copy-file file - (expand-file-name (concat (plist-get talk :video-slug) + (expand-file-name (concat (plist-get talk :file-prefix) (if (string= new-file "") "" (concat "--" new-file)) @@ -226,7 +226,7 @@ (list (emacsconf-complete-talk-info) .metadata.key (read-string (format "Filename: "))))) - (let ((new-filename (concat (plist-get talk :video-slug) + (let ((new-filename (concat (plist-get talk :file-prefix) (if (string= filename "") filename (concat "--" filename)) @@ -436,7 +436,7 @@ If INFO is specified, limit it to that list." ;; Prep (:bbb-room "ROOM") ;; Processing - (:video-slug "VIDEO_SLUG") + (:file-prefix "FILE_PREFIX") (:video-file "VIDEO_FILE") (:video-time "VIDEO_TIME") (:video-file-size "VIDEO_FILE_SIZE") @@ -1142,7 +1142,7 @@ The subheading should match `emacsconf-abstract-heading-regexp'." (cons :end-time (format-time-string "%FT%T%z" (plist-get o :end-time) t)) (mapcar (lambda (field) (cons field (plist-get o field))) - '(:slug :title :speakers :pronouns :pronunciation :url :track :video-slug))) + '(:slug :title :speakers :pronouns :pronunciation :url :track :file-prefix))) ) (emacsconf-filter-talks (emacsconf-get-talk-info))))))))) @@ -1505,7 +1505,7 @@ tracks with the ID in the cdr of that list." (interactive (let ((talk (emacsconf-complete-talk-info))) (list talk - (completing-read "File: " (directory-files emacsconf-cache-dir t (plist-get talk :video-slug)))))) + (completing-read "File: " (directory-files emacsconf-cache-dir t (plist-get talk :file-prefix)))))) (find-file filename)) (defun emacsconf-cache-find-file (filename) @@ -1535,12 +1535,12 @@ tracks with the ID in the cdr of that list." (defun emacsconf-talk-file (talk suffix &optional always source) (let ((wiki-filename - (expand-file-name (concat (plist-get talk :video-slug) suffix) + (expand-file-name (concat (plist-get talk :file-prefix) suffix) (expand-file-name "captions" (expand-file-name (plist-get talk :year) emacsconf-directory)))) (cache-filename - (expand-file-name (concat (plist-get talk :video-slug) suffix) + (expand-file-name (concat (plist-get talk :file-prefix) suffix) emacsconf-cache-dir))) (cond ((and (file-exists-p wiki-filename) (not (eq source 'cache))) wiki-filename) |