summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-12-21 09:47:29 -0500
committerSacha Chua <sacha@sachachua.com>2022-12-21 09:47:29 -0500
commit7ff8f33b89acd67a8f30ad068f8575b77022dd8e (patch)
tree6d2c0327ea9239aa3cb79df77ce044ea6d69f757
parent38a7562df8daadfee638ec34a1a0adc8f56899ce (diff)
downloademacsconf-el-7ff8f33b89acd67a8f30ad068f8575b77022dd8e.tar.xz
emacsconf-el-7ff8f33b89acd67a8f30ad068f8575b77022dd8e.zip
publishing talk files, use the wiki as the main copy if it exists
-rw-r--r--emacsconf-publish.el31
-rw-r--r--emacsconf.el22
2 files changed, 36 insertions, 17 deletions
diff --git a/emacsconf-publish.el b/emacsconf-publish.el
index 412696d..f43542d 100644
--- a/emacsconf-publish.el
+++ b/emacsconf-publish.el
@@ -51,6 +51,7 @@
(defun emacsconf-publish-update-talk (talk)
"Publish the schedule page and the page for this talk."
(interactive (list (emacsconf-complete-talk-info)))
+ (when (stringp talk) (setq talk (emacsconf-resolve-talk talk)))
(when (functionp 'emacsconf-upcoming-insert-or-update)
(emacsconf-upcoming-insert-or-update))
(emacsconf-publish-with-wiki-change
@@ -288,9 +289,7 @@
(let* ((video-base (and (stringp video-file) (replace-regexp-in-string "reencoded\\|original" "main" (file-name-base video-file))))
(chapter-info (and (stringp video-file)
(emacsconf-make-chapter-strings
- (expand-file-name
- (concat video-base "--chapters.vtt")
- emacsconf-cache-dir)
+ (plist-get talk :chapter-file)
(plist-get talk :track-base-url)
video-id)))
(info
@@ -443,7 +442,8 @@ resources."
:base-url
(concat emacsconf-media-base-url (plist-get o :conf-year) "/")
:track-base-url
- (format "/%s/captions/" (plist-get o :conf-year)))
+ (format "/%s/captions/" (plist-get o :conf-year))
+ :chapter-file (emacsconf-talk-file o "--main--chapters.vtt"))
o))
(concat
(if (plist-get o :qa-public) "# Talk\n\n" "")
@@ -460,7 +460,9 @@ resources."
:toobnix-url nil
:captions-edited (plist-get o :qa-captions-edited)
:video-file (emacsconf-talk-file o "--answers.webm")
- :audio-file (emacsconf-talk-file o "--answers.opus"))
+ :audio-file (emacsconf-talk-file o "--answers.opus")
+ :chapter-file (emacsconf-talk-file o "--answers--chapters.vtt"))
+
o)
(list "--answers.webm" "--answers.vtt" "--answers--chapters.vtt" "--answers.opus")))
"")))
@@ -1378,9 +1380,8 @@ answers without needing to listen to everything again. You can see <a href=\"htt
:video-id (concat "qanda-" (plist-get f :slug))
:track-base-url
(format "/%s/captions/" (plist-get f :conf-year))
- :video-file (expand-file-name
- (concat (file-name-sans-extension (plist-get f :video-slug)) "--answers.webm")
- emacsconf-cache-dir))
+ :video-file
+ (emacsconf-talk-file f "--answers.webm"))
f)
(list "--answers.vtt" "--answers--chapters.vtt" "--answers.webm"))
"")))
@@ -2372,6 +2373,20 @@ This video is available under the terms of the Creative Commons Attribution-Shar
(org-entry-put (point) "QA_YOUTUBE" output)))
output)))
+(defun emacsconf-publish-talk-file ()
+ (interactive)
+ (emacsconf-upload-to-backstage)
+ (mapc (lambda (file)
+ (copy-file file (expand-file-name (file-name-nondirectory file)
+ emacsconf-public-media-directory)
+ t))
+ (or (dired-get-marked-files)
+ (list (buffer-file-name))))
+ (mapc #'emacsconf-publish-update-talk
+ (seq-uniq (seq-map #'emacsconf-get-slug-from-string (or (dired-get-marked-files)
+ (list (buffer-file-name))))))
+ (emacsconf-publish-public-index)
+ (emacsconf-publish-backstage-index))
;;
(provide 'emacsconf-publish)
diff --git a/emacsconf.el b/emacsconf.el
index f7afc0c..39fe642 100644
--- a/emacsconf.el
+++ b/emacsconf.el
@@ -317,7 +317,7 @@
(cond
((and search (stringp search) (string-match "\\(.*?\\) - " search))
(match-string 1 search))
- ((and (stringp search) (string-match (concat "^" emacsconf-id "-" emacsconf-year "-\\(.+?\\)--") search))
+ ((and (stringp search) (string-match (concat emacsconf-id "-" emacsconf-year "-\\(.+?\\)--") search))
(match-string 1 search))
(t search)))
@@ -1466,14 +1466,18 @@ tracks with the ID in the cdr of that list."
(mapcar (lambda (o) (plist-get o prop)) list))
(defun emacsconf-talk-file (talk suffix &optional always source)
- (let ((filename (expand-file-name (concat (plist-get talk :video-slug) suffix)
- (if (eq source 'wiki-captions)
- (expand-file-name "captions"
- (expand-file-name (plist-get talk :year)
- emacsconf-directory))
- )
- emacsconf-cache-dir)))
- (and (or always (file-exists-p filename)) filename)))
+ (let ((wiki-filename
+ (expand-file-name (concat (plist-get talk :video-slug) 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)
+ emacsconf-cache-dir)))
+ (cond
+ ((and (file-exists-p wiki-filename) (not (eq source 'cache))) wiki-filename)
+ ((and (file-exists-p cache-filename) (not (eq source 'wiki-captions))) cache-filename)
+ (always cache-filename))))
(provide 'emacsconf)
;;; emacsconf.el ends here