diff options
Diffstat (limited to '')
-rw-r--r-- | emacsconf-publish.el | 206 |
1 files changed, 143 insertions, 63 deletions
diff --git a/emacsconf-publish.el b/emacsconf-publish.el index bedc40f..650173b 100644 --- a/emacsconf-publish.el +++ b/emacsconf-publish.el @@ -104,6 +104,8 @@ (emacsconf-ical-generate-all) (emacsconf-publish-schedule-org-files) (emacsconf-publish-watch-pages) + (emacsconf-pad-prepopulate-all-talks) + (emacsconf-pad-prepopulate-hyperlists) (when (functionp 'emacsconf-pentabarf-generate) (emacsconf-pentabarf-generate)))) @@ -856,21 +858,6 @@ Back to the [[talks]] \n" (emacsconf-publish-before-page o info)) info))) -(defun emacsconf-publish-talks-page (&optional emacsconf-info) - "Generate a list of talks." - (interactive) - (let ((info (or emacsconf-info - (sort - (seq-filter #'emacsconf-publish-talk-p - (or emacsconf-schedule-draft (emacsconf-get-talk-info))) - #'emacsconf-sort-by-track-then-schedule))) - (range (format "<%s %s-%s>" - emacsconf-date - (plist-get (car emacsconf-tracks) :start) - (plist-get (car emacsconf-tracks) :end)))) - (with-temp-file (expand-file-name "talk-details.md" (expand-file-name emacsconf-year emacsconf-directory)) -)) - (defun emacsconf-generate-main-schedule-with-tracks (&optional info) (interactive (list nil)) (setq info (or info (emacsconf-publish-prepare-for-display info))) @@ -1041,7 +1028,12 @@ Entries are sorted chronologically, with different tracks interleaved." :timezone emacsconf-timezone :gmt-offset emacsconf-timezone-offset :alternative-timezones - (string-join (emacsconf-timezone-strings range nil "~%-l:%M %p") + (string-join (emacsconf-timezone-strings + (format "<%s %s-%s>" + emacsconf-date + (plist-get (car emacsconf-tracks) :start) + (plist-get (car emacsconf-tracks) :end)) + nil "~%-l:%M %p") " / ") :icals (concat @@ -1679,7 +1671,15 @@ ${include} :qa-url :qa-type :qa-backstage-url)))) - (emacsconf-filter-talks (emacsconf-get-talk-info))))))) + (emacsconf-filter-talks (emacsconf-get-talk-info))) + :tracks + (mapcar + (lambda (o) + (mapcar + (lambda (field) + (cons field (plist-get o field))) + '(:name :color :id :channel :webchat-url :stream :480p :start :end))) + emacsconf-tracks))))) (defun emacsconf-publish-talks-json-to-files () "Export talk information as JSON so that we can use it in shell scripts." @@ -2082,8 +2082,14 @@ This video is available under the terms of the Creative Commons Attribution-Shar (defun emacsconf-publish-format-watch-index (info) (concat "<!-- Automatically generated by emacsconf-publish-watch-pages -->\n -<h2>Tracks</h2>" - "<table width=\"100%\"><tr><th>Watch page</th><th>IRC channel (libera.chat)</th><th>URL for streaming player (ex: mpv, vlc, ffplay)</th><th>Low res</th></tr>\n" +<h2>Tracks</h2> +We recommend using a streaming player like mpv to watch the livestreams. Example: <pre> +" + (mapconcat (lambda (track) + (concat "mpv " (plist-get track :stream) "\n")) + emacsconf-tracks + "") + "</pre><table width=\"100%\"><tr><th>Watch page</th><th>IRC channel (libera.chat)</th><th>URL for streaming player (ex: mpv, vlc, ffplay)</th><th>Low res</th></tr>\n" (mapconcat (lambda (track) (emacsconf-replace-plist-in-string (append (list :year emacsconf-year) track) @@ -2485,68 +2491,90 @@ This video is available under the terms of the Creative Commons Attribution-Shar (emacsconf-with-talk-heading talk)) result)) -(defvar emacsconf-publish-toobnix-upload-command '("node" "/home/sacha/vendor/PeerTube/dist/server/tools/peertube.js")) +(defvar emacsconf-publish-toobnix-upload-command "peertube-cli") +(defvar emacsconf-publish-toobnix-channel "EmacsConf") +;; (defun emacsconf-publish-get-toobnix-token () +;; (let ((secrets (plz 'get "https://toobnix.org/api/v1/oauth-clients/local" :as #'json-read))) + +;; ) + +;; ) (defun emacsconf-publish-upload-to-toobnix (properties) + "Uses peertube-cli: https://github.com/Chocobozzz/PeerTube/blob/develop/support/doc/tools.md" (with-temp-buffer - (apply #'call-process - (car emacsconf-publish-toobnix-upload-command) - nil t t + (let ((arguments (append - (cdr emacsconf-publish-toobnix-upload-command) (list "upload" "-f" (plist-get properties :file)) (when (plist-get properties :title) (list "-n" (plist-get properties :title))) (when (plist-get properties :description) (list "-d" (plist-get properties :description))) - (list "-l" "2" "-c" "15" "-P" (if (string= (plist-get properties :privacy) "unlisted") "2" "1") "-t" + (list "-L" "en" + "-C" emacsconf-publish-toobnix-channel + "-l" "2" + "-c" "15" + "-P" (if (string= (plist-get properties :privacy) "public") "1" "2") "-t" (cond ((stringp (plist-get properties :tags)) (plist-get properties :tags)) ((listp (plist-get properties :tags)) (string-join (plist-get properties :tags) ",")) - (t "emacs"))))) - (buffer-string))) + (t "emacs")))))) + (kill-new (mapconcat + #'shell-quote-argument + (append (list emacsconf-publish-toobnix-upload-command) arguments) + " ")) + (apply #'call-process + emacsconf-publish-toobnix-upload-command + nil t t arguments) + (buffer-string)))) ;; YouTube (defvar emacsconf-publish-youtube-upload-command '("python3" "/home/sacha/vendor/youtube-upload/bin/youtube-upload")) (defun emacsconf-publish-upload-to-youtube (properties) - (with-temp-buffer - (apply #'call-process - (car emacsconf-publish-youtube-upload-command) - nil t t - (append - (cdr emacsconf-publish-youtube-upload-command) - (when (plist-get properties :title) - (list "--title" (plist-get properties :title))) - (when (plist-get properties :description) - (list "--description" (plist-get properties :description))) - (delq - nil - (list - (concat "--tags=" - (cond - ((stringp (plist-get properties :tags)) - (plist-get properties :tags)) - ((listp (plist-get properties :tags)) - (string-join (plist-get properties :tags) ",")) - (t "emacs"))) - (concat "--category=" (or (plist-get properties :category) "Science & Technology")) - (concat "--license=" (or (plist-get properties :license) "creativeCommon")) - (when (plist-get properties :date) - (concat "--recording-date=" - (format-time-string "%Y-%m-%dT%H:%M:%SZ" - (plist-get properties :date) t))) - (concat "--default-language=" - (or (plist-get properties :lang) "en")) - (concat "--default-audio-language=" - (or (plist-get properties :lang) "en")) - (when (plist-get properties :playlist) - (concat "--playlist=" (plist-get properties :playlist))) - "--embeddable=true")) - (list (plist-get properties :file)))) - (buffer-string))) + (let ((arguments (append + (cdr emacsconf-publish-youtube-upload-command) + (when (plist-get properties :title) + (list "--title" (plist-get properties :title))) + (when (plist-get properties :description) + (list "--description" (plist-get properties :description))) + (delq + nil + (list + (concat "--tags=" + (cond + ((stringp (plist-get properties :tags)) + (plist-get properties :tags)) + ((listp (plist-get properties :tags)) + (string-join (plist-get properties :tags) ",")) + (t "emacs"))) + (concat "--category=" (or (plist-get properties :category) "Science & Technology")) + (concat "--privacy=" (or (plist-get properties :privacy) "unlisted")) + (concat "--license=" (or (plist-get properties :license) "creativeCommon")) + (when (plist-get properties :date) + (concat "--recording-date=" + (format-time-string "%Y-%m-%dT%H:%M:%SZ" + (plist-get properties :date) t))) + (concat "--default-language=" + (or (plist-get properties :lang) "en")) + (concat "--default-audio-language=" + (or (plist-get properties :lang) "en")) + (when (plist-get properties :playlist) + (concat "--playlist=" (plist-get properties :playlist))) + "--embeddable=true")) + (list (plist-get properties :file))))) + (kill-new (mapconcat 'shell-quote-argument (append (seq-take emacsconf-publish-youtube-upload-command 1) + arguments) " ")) + (with-current-buffer (get-buffer-create "*YouTube*") + (erase-buffer) + (apply #'call-process + (car emacsconf-publish-youtube-upload-command) + nil t t + arguments) + (display-buffer (current-buffer)) + (buffer-string)))) (defun emacsconf-publish-answers-title (talk &optional len) (let ((title (concat emacsconf-name " " emacsconf-year " Q&A: " (plist-get talk :title)))) @@ -2554,6 +2582,29 @@ This video is available under the terms of the Creative Commons Attribution-Shar title (concat (substring title 0 (- len 3)) "...")))) +(defun emacsconf-publish-talk-description (talk platform) + (let ((title (concat emacsconf-name " " emacsconf-year ": " (plist-get talk :title)))) + (concat + (if (< (length title) 100) "" (concat title "\n")) + (plist-get talk :speakers-with-pronouns) "\n\n" + (plist-get talk :absolute-url) "\n\n" + (if (emacsconf-talk-file talk "--main--chapters.vtt") + (let ((chapters (subed-parse-file (emacsconf-talk-file talk "--main--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"))) + (defun emacsconf-publish-answers-description (talk platform) (let ((title (concat emacsconf-name " " emacsconf-year " Q&A: " (plist-get talk :title)))) (concat @@ -2571,7 +2622,6 @@ This video is available under the terms of the Creative Commons Attribution-Shar (if (= (elt chapter 1) 0) "00:00" (format-seconds "%.2h:%z%.2m:%.2s" (floor (/ (elt chapter 1) 1000)))) - (format ".%03d" (% (elt chapter 1) 1000)) " " (elt chapter 3) "\n")) chapters "") @@ -2581,7 +2631,37 @@ This video is available under the terms of the Creative Commons Attribution-Shar "This video is available under the terms of the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.\n"))) ;; (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) + "Comma-separated tags to add to the talk videos.") +(defun emacsconf-publish-upload-talk (talk platform) + (interactive + (list (emacsconf-complete-talk-info) + (intern (completing-read "Platform: " '("youtube" "toobnix"))))) + (let ((file (emacsconf-talk-file talk "--main.webm")) + (title (concat emacsconf-name " " emacsconf-year ": " + (plist-get talk :title) " - " (plist-get talk :speakers))) + output) + (when (and file (not (plist-get talk (if (eq platform 'toobnix) :toobnix-url :youtube-url)))) + (setq output + (funcall + (if (eq platform 'toobnix) + #'emacsconf-publish-upload-to-toobnix + #'emacsconf-publish-upload-to-youtube) + (list + :file file + :tags emacsconf-publish-talk-video-tags + :playlist (concat emacsconf-name " " emacsconf-year) + :date (plist-get talk :start-time) + :privacy (if (plist-get talk :public) "public" "unlisted") + :title (if (< (length title) 100) title (concat (substring title 0 97) "...")) + :description (emacsconf-publish-talk-description talk platform)))) + (when (and (string-match "Video URL: \\(.*+\\)" output) (eq platform 'youtube)) + (setq output (match-string 1 output)) + (save-window-excursion + (emacsconf-go-to-talk talk) + (org-entry-put (point) "YOUTUBE_URL" output))) + output))) (defun emacsconf-publish-upload-answers (talk platform) (let ((file (emacsconf-talk-file talk "--answers.webm")) |