From b7bce37c751d0b7a7d18ea9ccaa40faa647d8675 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Sat, 20 Dec 2025 18:30:01 -0500 Subject: working with more types of files --- emacsconf-publish.el | 104 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 64 insertions(+), 40 deletions(-) diff --git a/emacsconf-publish.el b/emacsconf-publish.el index a8884ea..cbaf233 100644 --- a/emacsconf-publish.el +++ b/emacsconf-publish.el @@ -446,9 +446,7 @@ )) (let ((tracks (emacsconf-video-subtitle-tracks - (or (plist-get talk :caption-file) - (emacsconf-talk-file talk "--main.vtt") - (emacsconf-talk-file talk "--reencoded.vtt")) + (plist-get talk :caption-file) (or (plist-get talk :track-base-url) (plist-get talk :base-url)) (plist-get talk :files)))) @@ -467,8 +465,10 @@ (plist-get chapter-info :html)) "") :video-id video-id - :video-file-size (if (and (stringp video-file) (file-exists-p video-file)) - (file-size-human-readable (file-attribute-size (file-attributes video-file)))) + :video-file-size (if (and (stringp video-file) + (file-exists-p + (expand-file-name video-file emacsconf-cache-dir))) + (file-size-human-readable (file-attribute-size (file-attributes (expand-file-name video-file emacsconf-cache-dir))))) :links (concat (emacsconf-surround "
  • " s "
  • ")) - (emacsconf-publish-link-file-formats-as-list talk) + (emacsconf-publish-link-file-formats-as-list + talk + (seq-filter (lambda (o) (string-match "--answers" o)) + (emacsconf-publish-filter-public-files talk))) "") :youtube-info (if (plist-get talk :youtube-url) (format @@ -517,7 +520,7 @@ :video (emacsconf-replace-plist-in-string info - (if (and (stringp video-file) (string-match "webm$" video-file)) + (if (stringp video-file) "${chapter-list}" (or (plist-get talk :video-note) ""))) :audio @@ -650,7 +653,7 @@ ${categories} :toobnix-url (plist-get o :qa-toobnix) :captions-edited (plist-get o :qa-captions-edited) :caption-file (emacsconf-talk-file o "--answers.vtt") - :video-file (emacsconf-talk-file o "--answers.webm") + :video-file (plist-get o :qa-video-file) :video-duration (plist-get o :qa-video-duration) :audio-file (emacsconf-talk-file o "--answers.opus") :chapter-file (emacsconf-talk-file o "--answers--chapters.vtt") @@ -1716,6 +1719,8 @@ answers without needing to listen to everything again. You can see "))) @@ -1906,8 +1918,8 @@ ${include} (format " (%sB)" (file-size-human-readable (file-attribute-size (file-attributes cache-file)))) "")))) -(defun emacsconf-publish-link-file-formats-as-list (talk) - (let ((public-files (emacsconf-publish-filter-public-files talk))) +(defun emacsconf-publish-link-file-formats-as-list (talk &optional files) + (let ((public-files (or files (emacsconf-publish-filter-public-files talk)))) (seq-map (lambda (file) (let ((cache-file (expand-file-name (file-name-nondirectory file) emacsconf-cache-dir))) @@ -2163,8 +2175,11 @@ ${include} (concat (regexp-quote (if suffix (concat file-prefix "--" suffix) file-prefix)) - "\\." (regexp-opt emacsconf-media-extensions)) s)) files)) - '("main" "captioned" "normalized" "reencoded" "compressed" "original" nil))) + "\\.\\(" (regexp-opt emacsconf-media-extensions) + "\\)") + s)) + files)) + '("main" "captioned" "normalized" "reencoded" "compressed" "original"))) (seq-find 'file-exists-p (seq-map (lambda (suffix) @@ -3003,29 +3018,37 @@ Tends to be quota-limited, though." "This video is available under the terms of the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.\n"))) (defun emacsconf-publish-answers-description (talk platform) - (let ((title (concat emacsconf-name " " emacsconf-year " Q&A: " (plist-get talk :title)))) - (concat - (if (< (length title) 100) "" (concat title "\n")) - (plist-get talk :speakers-with-pronouns) "\n\n" - "This is the Q&A for the talk at " - (plist-get talk - (if (eq platform 'toobnix) :toobnix-url :youtube-url)) " .\n\n" - (if (emacsconf-talk-file talk "--answers--chapters.vtt") - (let ((chapters (subed-parse-file (emacsconf-talk-file talk "--answers--chapters.vtt")))) - (concat - (mapconcat - (lambda (chapter) - (concat - (if (= (elt chapter 1) 0) - "00:00" - (format-seconds "%.2h:%z%.2m:%.2s" (floor (/ (elt chapter 1) 1000)))) - " " (elt chapter 3) "\n")) - chapters - "") - "\n")) - "") - "You can view this and other resources using free/libre software at " (plist-get talk :absolute-url) " .\n" - "This video is available under the terms of the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.\n"))) + (interactive (list (emacsconf-complete-talk-info) 'youtube)) + (let ((title (concat emacsconf-name " " emacsconf-year " Q&A: " (plist-get talk :title))) + s) + (setq s + (concat + (if (and (not (called-interactively-p 'any)) (< (length title) 100)) + "" + (concat title "\n")) + (plist-get talk :speakers-with-pronouns) "\n\n" + "This is the Q&A for the talk at " + (plist-get talk + (if (eq platform 'toobnix) :toobnix-url :youtube-url)) " .\n\n" + (if (emacsconf-talk-file talk "--answers--chapters.vtt") + (let ((chapters (subed-parse-file (emacsconf-talk-file talk "--answers--chapters.vtt")))) + (concat + (mapconcat + (lambda (chapter) + (concat + (if (= (elt chapter 1) 0) + "00:00" + (format-seconds "%.2h:%z%.2m:%.2s" (floor (/ (elt chapter 1) 1000)))) + " " (elt chapter 3) "\n")) + chapters + "") + "\n")) + "") + "You can view this and other resources using free/libre software at " (plist-get talk :absolute-url) " .\n" + "This video is available under the terms of the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.\n")) + (when (called-interactively-p 'any) + (kill-new s)) + s)) ;; (emacsconf-publish-answers-description (emacsconf-resolve-talk "async") 'toobnix) (defvar emacsconf-publish-talk-video-tags (format "emacs,%s,%s%s" emacsconf-id emacsconf-id emacsconf-year) @@ -3102,7 +3125,8 @@ Tends to be quota-limited, though." output))) (defun emacsconf-publish-upload-answers-to-youtube (talk) - (let ((file (emacsconf-talk-file talk "--answers.webm")) + (interactive (list (emacsconf-complete-talk-info))) + (let ((file (plist-get talk :qa-video-file)) (title (concat emacsconf-name " " emacsconf-year " Q&A: " (plist-get talk :title))) output) (when (and file (not (plist-get talk :qa-youtube))) -- cgit v1.2.3