From 63f6ea3cc24d7c8f0de4f10f47780cf649325940 Mon Sep 17 00:00:00 2001 From: Leo Vivier Date: Sun, 23 Oct 2022 20:25:15 +0200 Subject: Minor fixups to script --- 2022/organizers-notebook/index.org | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to '2022/organizers-notebook') diff --git a/2022/organizers-notebook/index.org b/2022/organizers-notebook/index.org index 02415adc..e9cd7912 100644 --- a/2022/organizers-notebook/index.org +++ b/2022/organizers-notebook/index.org @@ -3695,10 +3695,11 @@ Throw an error if ERROR is non-nil, skip otherwise." #+begin_src sh :eval no :tangle prerecs-wait-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 @@ -3739,6 +3740,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 @@ -3747,12 +3771,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 -- cgit v1.2.3 From 6036f3d66d117ce01a41a697a779b18d0cecd994 Mon Sep 17 00:00:00 2001 From: Leo Vivier Date: Sun, 23 Oct 2022 20:25:39 +0200 Subject: Rename script --- 2022/organizers-notebook/index.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '2022/organizers-notebook') diff --git a/2022/organizers-notebook/index.org b/2022/organizers-notebook/index.org index e9cd7912..b315a95c 100644 --- a/2022/organizers-notebook/index.org +++ b/2022/organizers-notebook/index.org @@ -3692,7 +3692,7 @@ 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 -- cgit v1.2.3 From 510b6931fb7d9dd49186f719331178a67aa7a894 Mon Sep 17 00:00:00 2001 From: Leo Vivier Date: Sun, 23 Oct 2022 21:18:14 +0200 Subject: Add stodgy scripts that took way too long to write --- 2022/organizers-notebook/index.org | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to '2022/organizers-notebook') diff --git a/2022/organizers-notebook/index.org b/2022/organizers-notebook/index.org index b315a95c..14e75392 100644 --- a/2022/organizers-notebook/index.org +++ b/2022/organizers-notebook/index.org @@ -3787,8 +3787,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 () -- cgit v1.2.3