diff options
author | Sacha Chua <sacha@sachachua.com> | 2022-10-26 12:18:46 -0400 |
---|---|---|
committer | Sacha Chua <sacha@sachachua.com> | 2022-10-26 12:18:46 -0400 |
commit | dc9337742ac3d363eacf08e02f8b8f11a83e527e (patch) | |
tree | 598d665a5a5382e7037dd82e5a2b126c08df5241 /2022 | |
parent | 26b61e58dc7486c242acd8cce6d8e90872908d02 (diff) | |
parent | 510b6931fb7d9dd49186f719331178a67aa7a894 (diff) | |
download | emacsconf-wiki-dc9337742ac3d363eacf08e02f8b8f11a83e527e.tar.xz emacsconf-wiki-dc9337742ac3d363eacf08e02f8b8f11a83e527e.zip |
Merge branch 'master' of git://git.emacsconf.org/emacsconf-wiki
Diffstat (limited to '2022')
-rw-r--r-- | 2022/organizers-notebook/index.org | 72 |
1 files changed, 68 insertions, 4 deletions
diff --git a/2022/organizers-notebook/index.org b/2022/organizers-notebook/index.org index eb680a08..914d017b 100644 --- a/2022/organizers-notebook/index.org +++ b/2022/organizers-notebook/index.org @@ -3757,13 +3757,14 @@ Throw an error if ERROR is non-nil, skip otherwise." #+end_src ** Prerecs *** Receive notification when new prerecs are available -#+begin_src sh :eval no :tangle prerecs-wait-new.sh +#+begin_src sh :eval no :tangle prerecs-check-new.sh #!/usr/bin/env sh +set -eu + sleep_duration=600 data="$(basename "$0" ".sh").data" -touch "$data" plural () { if [ "$2" = 1 ] || [ "$2" = -1 ]; then @@ -3804,6 +3805,29 @@ _sleep() { sleep "$sleep_duration" } +fetch() { + TERM=xterm ssh orga@media.emacsconf.org -- ls -1 /srv/upload | wc -l +} + +clean() { + rm -f "$data" + log "Data file has been cleaned" +} + +if [ "$#" -gt 0 ]; then + command="$1" + if [ "$command" = "clean" ]; then + clean + exit 0 + fi + + if [ "$command" = "clean-start" ]; then + clean + fi +fi + +touch "$data" + log2 "Currently waiting for prerec" while true; do @@ -3812,12 +3836,12 @@ while true; do while true; do log "Checking..." - prerecs_number_current="$(TERM=xterm ssh orga@media.emacsconf.org -- ls -1 /srv/upload | wc -l)" + prerecs_number_current="$(fetch)" diff=$((prerecs_number_current - prerecs_number_past)) if [ $diff -gt 0 ]; then break fi - log "No new prerec." + log "No new prerec" _sleep done @@ -3828,8 +3852,48 @@ while true; do _sleep done #+end_src +*** Fetch upload data +#+begin_src sh :eval no :tangle prerecs-fetch-upload-data.sh +#!/usr/bin/env sh +set -eu +current_time() { + date +"[%T]" +} + +log() { + printf "%s $1\n" "$(current_time)" +} + +if [ -t 0 ]; then + log "Fetching data..." +fi + +TERM=xterm ssh orga@media.emacsconf.org -- cat /srv/upload/*/*json +#+end_src +*** Fetch new talk data formatted +#+begin_src sh :eval no :tangle prerecs-fetch-new.sh +#!/usr/bin/env sh + +set -eu + +echo "Fetching data..." +data_raw="$(./fetch-upload-data.sh)" + +echo + +echo "$data_raw" | awk "$(cat << EOF +func dewrap(a) {gsub(/^ *".*": "|",$/, "", a); return a}; +BEGIN {i=0}; +/^ "sid"/ { a[0] = dewrap(\$0); }; +/^ "name"/ { a[2] = sprintf("%s\t", dewrap(\$0)) }; +/^ "comment"/ { a[3] = sprintf("%s\t", dewrap(\$0)); if (a[3] == "\t"){a[3] = "No comment"} }; +/^ "key"/ { a[1] = dewrap(\$0); }; +/^\}/ { printf "[%d]\t%s\t%s\t%s\n\t%s\n\n", i, a[0], a[1], a[2], a[3]; i=i+1}; +EOF + )" +#+end_src ** Publish this page #+begin_src emacs-lisp (defun emacsconf-org-publish-this-page () |