diff options
Diffstat (limited to '2022/organizers-notebook')
-rw-r--r-- | 2022/organizers-notebook/index.org | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/2022/organizers-notebook/index.org b/2022/organizers-notebook/index.org index 68abe0e6..0a31aced 100644 --- a/2022/organizers-notebook/index.org +++ b/2022/organizers-notebook/index.org @@ -3376,6 +3376,53 @@ Throw an error if ERROR is non-nil, skip otherwise." (message "Back to safety. Phew!") #+end_src +** Prerecs +*** Receive notification when new prerecs are available +#+begin_src sh :eval no :tangle prerecs-wait-new.sh +#!/usr/bin/env sh + +set -xeu + +sleep_duration=1800 + +data=prerec-wait-new.data +touch check-new-prerecs.data + +prerecs_number_current="$(TERM=xterm ssh orga@media.emacsconf.org -- ls -1 /srv/upload | wc -l)" + +plural() { + if [ "$2" = 1 ] || [ "$2" = -1 ]; then + echo "${1}" + else + case $1 in + "is" ) + "are" + ;; + * ) + "${1}s" + esac + fi +} + +notify() { + echo "$1" + notify-send -t 0 "EmacsConf" "$1" +} + +prerecs_number_past=$(cat check-new-prerecs.data) +diff=$((prerecs_number_current - prerecs_number_past)) + +echo "Currently waiting for prerec" + +while [ $diff = 0 ]; do + sleep "$sleep_duration" +done + +notify "Yay~, $diff new $(plural "prerec" $diff) $(plural "is" $diff) available!" + +echo "$prerecs_number_current" > "$data" +#+end_src + ** Publish this page #+begin_src emacs-lisp |