diff options
author | Sacha Chua <sacha@sachachua.com> | 2023-10-15 21:40:46 -0400 |
---|---|---|
committer | Sacha Chua <sacha@sachachua.com> | 2023-10-15 21:40:46 -0400 |
commit | 92983544ea1448c06c57bdbe014c08aa9a41cfe9 (patch) | |
tree | 9b2f86b36b53a95a03d3ffbe69c27d8c80c0caf2 | |
parent | 1fd8e1de812399fc0fa617dcc0513e15ca9378f2 (diff) | |
download | emacsconf-el-92983544ea1448c06c57bdbe014c08aa9a41cfe9.tar.xz emacsconf-el-92983544ea1448c06c57bdbe014c08aa9a41cfe9.zip |
move json publishing to emacsconf-publish
-rw-r--r-- | emacsconf-publish.el | 29 | ||||
-rw-r--r-- | emacsconf.el | 51 |
2 files changed, 52 insertions, 28 deletions
diff --git a/emacsconf-publish.el b/emacsconf-publish.el index 9d311b7..a142fd7 100644 --- a/emacsconf-publish.el +++ b/emacsconf-publish.el @@ -1209,7 +1209,6 @@ Entries are sorted chronologically, with different tracks interleaved." (interactive) (setq filename (or filename (expand-file-name "index.html" emacsconf-backstage-dir))) (let ((info (or emacsconf-schedule-draft (emacsconf-publish-prepare-for-display (emacsconf-get-talk-info)))) - (default-directory emacsconf-cache-dir) (emacsconf-main-extensions (append emacsconf-main-extensions emacsconf-publish-backstage-extensions))) (with-temp-file filename (let* ((talks @@ -1533,6 +1532,32 @@ answers without needing to listen to everything again. You can see <a href=\"htt (and (file-exists-p file) file))) extensions))))) +(defun emacsconf-publish-talks-json () + "Return JSON format with a subset of talk information." + (json-encode + (list + :talks + (mapcar + (lambda (o) + (apply + 'list + (cons :start-time (format-time-string "%FT%T%z" (plist-get o :start-time) t)) + (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 :file-prefix)))) + (emacsconf-filter-talks (emacsconf-get-talk-info)))))) + +(defun emacsconf-publish-talks-json-to-files () + "Export talk information as JSON so that we can use it in shell scripts." + (interactive) + (mapc (lambda (dir) + (when (and dir (file-directory-p dir)) + (with-temp-file (expand-file-name "talks.json" dir) + (insert (emacsconf-talks-json))))) + (list emacsconf-res-dir emacsconf-ansible-directory))) + (defun emacsconf-talks-csv () "Make a CSV of the talks. Columns are: slug,title,speakers,talk page url,video url,duration,sha." @@ -1595,7 +1620,7 @@ answers without needing to listen to everything again. You can see <a href=\"htt (emacsconf-public-talks (emacsconf-get-talk-info)))))) (insert (orgtbl-to-csv (cons '("Conference" "Slug" "Title" "Speakers" "Talk page URL" "Video URL" "Date" "Duration" "SHA" "Youtube URL" "Toobnix URL") - results) + results) nil))))) (defun emacsconf-generate-pad-template (emacsconf-info) diff --git a/emacsconf.el b/emacsconf.el index 3d3dc6f..7839688 100644 --- a/emacsconf.el +++ b/emacsconf.el @@ -257,6 +257,31 @@ Return the list of new filenames." t)) (emacsconf-rename-files talk))) +(defun emacsconf-rename-and-upload-to-res-cache (talk &optional filename) + "Rename marked files or the current file, then upload to res cache." + (interactive (list (emacsconf-complete-talk-info))) + (mapc + (lambda (file) + (copy-file + file + (expand-file-name + (file-name-nondirectory file) + (expand-file-name "cache" + emacsconf-res-dir)) + t)) + (emacsconf-rename-files talk))) + +(defun emacsconf-copy-to-cache-and-backstage () + "Copy current file to cache and backstage." + (interactive) + (let ((file (buffer-file-name))) + (dolist (dir (list emacsconf-cache-dir emacsconf-backstage-dir)) + (copy-file + file + (expand-file-name (file-name-nondirectory file) + dir) + t)))) + (defun emacsconf-upload-copy-from-json (talk key filename) "Parse PsiTransfer JSON files and copy the uploaded file to the backstage directory. The file is associated with TALK. KEY identifies the file in a multi-file upload. @@ -1194,32 +1219,6 @@ The subheading should match `emacsconf-abstract-heading-regexp'." (message "Missing %s" (mapconcat #'symbol-name missing ", ")) (format "Missing %s" (mapconcat #'symbol-name missing ", ")))))) -(defun emacsconf-talks-json () - "Return JSON format with a subset of talk information." - (json-encode - (list - :talks - (mapcar - (lambda (o) - (apply - 'list - (cons :start-time (format-time-string "%FT%T%z" (plist-get o :start-time) t)) - (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 :file-prefix)))) - (emacsconf-filter-talks (emacsconf-get-talk-info)))))) - -(defun emacsconf-export-talks-json () - (interactive) - "Export talk information as JSON so that we can use it in shell scripts." - (mapc (lambda (dir) - (when (and dir (file-directory-p dir)) - (with-temp-file (expand-file-name "talks.json" dir) - (insert (emacsconf-talks-json))))) - (list emacsconf-res-dir emacsconf-ansible-directory))) - (defun emacsconf-ansible-load-vars (file) (interactive (list (read-file-name "File: " emacsconf-ansible-directory))) (with-temp-buffer |