diff options
| author | Sacha Chua <sacha@sachachua.com> | 2025-11-26 14:45:30 -0500 |
|---|---|---|
| committer | Sacha Chua <sacha@sachachua.com> | 2025-11-26 14:45:30 -0500 |
| commit | 16cbdc124d448afd1264fa37b12bd8f0f1841fd8 (patch) | |
| tree | c477806c4e9bfc73f07c84e6a703a068c220d635 | |
| parent | a921272d3c9c2c5c45ff3844ea16f2f8c9d105bb (diff) | |
| download | emacsconf-ansible-16cbdc124d448afd1264fa37b12bd8f0f1841fd8.tar.xz emacsconf-ansible-16cbdc124d448afd1264fa37b12bd8f0f1841fd8.zip | |
Diffstat (limited to '')
| -rw-r--r-- | README.org | 100 | ||||
| -rw-r--r-- | group_vars/all.yml | 1 | ||||
| -rw-r--r-- | roles/live/tasks/main.yml | 12 | ||||
| -rw-r--r-- | roles/obs/tasks/main.yml | 17 | ||||
| -rwxr-xr-x | roles/obs/templates/intro | 8 | ||||
| -rw-r--r-- | roles/prerec/templates/Makefile | 2 | ||||
| -rwxr-xr-x | roles/prerec/templates/process-prerec.sh | 7 | ||||
| -rwxr-xr-x | roles/prerec/templates/reencode.sh | 6 | ||||
| -rwxr-xr-x | roles/prerec/templates/upload.sh | 2 |
9 files changed, 49 insertions, 106 deletions
@@ -297,98 +297,17 @@ For each track: 1. Install the Tampermonkey extension by going to https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/ . -2. Install the BBB script by clicking on the Tampermonkey extension, choosing *Install New Script*, and pasting in the following: - - #+begin_src js :eval no - // ==UserScript== - // @name Emacsconf BBB setup - // @namespace https://emacsconf.org/ - // @version 0.2 - // @description Join BBB and set things up - // @author Sacha Chua - // @match https://bbb.emacsverse.org/* - // @icon https://www.google.com/s2/favicons?sz=64&domain=emacsverse.org - // @grant none - // ==/UserScript== - ( - async function() { - 'use strict'; - const NAME = 'emacsconf'; - async function waitUntil(conditionFunc, interval=500, timeout=null) { - let initResult = conditionFunc(); - if (initResult) return initResult; - return new Promise((resolve, reject) => { - let timeSoFar = 0; - let timer = setInterval(() => { - let result = conditionFunc(); - if (result) { - clearInterval(timer); - resolve(result); - } - timeSoFar += interval; - if (timeout && timeSoFar > timeout) { - clearInterval(timer); - reject(); - } - }, interval); - }); - } - // https://stackoverflow.com/questions/66536154/changing-input-text-of-a-react-app-using-javascript - function setNativeValue(element, value) { - const valueSetter = Object.getOwnPropertyDescriptor(element, 'value').set; - const prototype = Object.getPrototypeOf(element); - const prototypeValueSetter = Object.getOwnPropertyDescriptor(prototype, 'value').set; - - if (valueSetter && valueSetter !== prototypeValueSetter) { - prototypeValueSetter.call(element, value); - } else { - valueSetter.call(element, value); - } - } - setTimeout(function() { - if (document.querySelector('input#joinFormName')) { - setNativeValue(document.querySelector('input#joinFormName'), NAME); - document.querySelector('input#joinFormName').dispatchEvent(new Event('input', { bubbles: true })); - document.querySelector('input#consentCheck').click() - document.querySelector('button[type="submit"]').click(); - return; - } - if (document.querySelector('.icon-bbb-listen')) { - document.querySelector('.icon-bbb-listen').closest('button').click(); - } - if (document.querySelector('.icon-bbb-user')) { - document.querySelector('.icon-bbb-user').closest('button').click(); - } - }, 2000); - })(); - #+end_src +2. Install the BBB script by clicking on the Tampermonkey extension, choosing *Install New Script*, and using this as the URL. Enable checking for updates. + + https://live.emacsconf.org/emacsconf-tampermonkey-bbb.js + + (these are updated by the Ansible playbook tag "static") Press =Ctrl+s= to save. 3. Add this script for IRC: - #+begin_src js :eval no -// ==UserScript== -// @name Connect to EmacsConf chat automatically -// @namespace https://emacsconf.org/ -// @version 0.1 -// @description try to take over the world! -// @author You -// @match https://chat.emacsconf.org/* -// @icon https://www.google.com/s2/favicons?sz=64&domain=emacsconf.org -// @grant none -// ==/UserScript== - -(function() { - 'use strict'; - setTimeout(() => { - if (document.querySelector('.connect-row')) { - document.querySelector('.connect-row').closest('form').querySelector('button').click(); - } - }, 1000); -})(); - #+end_src - + https://live.emacsconf.org/emacsconf-tampermonkey-irc.js 4. Join an BBB meeting and switch out of full-screen with F11. Check the address bar to see if autoplay is disabled (crossed-out autoplay icon). If it is, click on it and change *Block audio* to *Allow audio and video*. @@ -419,6 +338,9 @@ ffmpeg -y -i handwritten/reencode.webm -t 60 -vcodec copy -acodec copy test.webm nodemon -w . -e yml -x 'ansible-playbook -i inventory.yml prod-playbook.yml --tags vnc; true' * Restreaming +:PROPERTIES: +:ID: 20251122T182719.845166 +:END: Add something like this to your ~prod-vars.yml~: @@ -460,7 +382,9 @@ restreaming_platforms: source: gen.webm #+end_src -It doesn't get automatically started, so you'll also need to call ~screen -S restream-$TRACK_ID-youtube~ and ~screen -S restream-$TRACK_ID-toobnix~. +This will set up scripts on the live0 server. + +It doesn't get automatically started, so you'll also need to call ~screen -S restream-$SHIFT_ID-youtube~ and ~screen -S restream-$TRACK_ID-toobnix~. * BBB ansible-playbook -i inventory.yml prod-playbook.yml --tags bbb * Local testing with vagrant diff --git a/group_vars/all.yml b/group_vars/all.yml index f9be97a..7865420 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -5,6 +5,7 @@ fps: 30 emacsconf_year: 2025 emacsconf_name: EmacsConf emacsconf_id: emacsconf +emacsconf_domain: emacsconf.org emacsconf_user: orga emacsconf_group: orga emacsconf_tracks: diff --git a/roles/live/tasks/main.yml b/roles/live/tasks/main.yml index 8ff5903..f49b2fd 100644 --- a/roles/live/tasks/main.yml +++ b/roles/live/tasks/main.yml @@ -1,6 +1,6 @@ - name: Create the directory for this year file: - path: /var/www/live.emacsconf.org/{{ item }} + path: /var/www/{{ emacsconf_live_domain }}/{{ item }} owner: "{{ emacsconf_user }}" group: "{{ emacsconf_user }}" state: directory @@ -10,8 +10,16 @@ - name: Set up nginx.conf template: src: live.emacsconf.org.conf - dest: /etc/nginx/sites-available/live.emacsconf.org + dest: /etc/nginx/sites-available/{{ emacsconf_live_domain }} - name: Reload nginx service: name: nginx state: reloaded +- name: Static files + tags: static + template: + src: "{{ item }}" + dest: "/var/www/{{ emacsconf_live_domain }}/{{ item }}" + loop: + - emacsconf-tampermonkey-bbb.js + - emacsconf-tampermonkey-irc.js diff --git a/roles/obs/tasks/main.yml b/roles/obs/tasks/main.yml index 5df7d56..95f12b6 100644 --- a/roles/obs/tasks/main.yml +++ b/roles/obs/tasks/main.yml @@ -47,6 +47,16 @@ template: src: xorg.conf dest: /etc/X11/xorg.conf +- name: Create directories + file: + owner: "{{ emacsconf_user }}" + group: "{{ emacsconf_group }}" + path: "{{ item }}" + state: directory + mode: 0775 + loop: + - "{{ emacsconf_asset_dir }}" + - "{{ emacsconf_asset_dir }}/stream" - name: Set up MPV and MPVC tags: mpv include_tasks: mpv.yml @@ -105,13 +115,6 @@ nopassword: true with_items: - "{{ emacsconf_tracks }}" -- name: Create directories - file: - owner: "{{ emacsconf_user }}" - group: "{{ emacsconf_group }}" - path: "{{ emacsconf_asset_dir }}" - state: directory - mode: 0775 - name: Set up scripts tags: wip, obs-scripts template: diff --git a/roles/obs/templates/intro b/roles/obs/templates/intro index 7af9c4c..9bf1161 100755 --- a/roles/obs/templates/intro +++ b/roles/obs/templates/intro @@ -8,7 +8,7 @@ fi SLUG=$1 FILE=$1 if [[ ! -f $FILE ]]; then - LIST=({{ emacsconf_caption_dir }}/cache/emacsconf-{{ emacsconf_year }}-$FILE--*.webm) + LIST=({{ emacsconf_caption_dir }}/cache/emacsconf-{{ emacsconf_year }}-$FILE--*--intro.webm) FILE="${LIST[0]}" BY_SLUG=1 else @@ -17,7 +17,9 @@ fi shift overlay $SLUG if [[ -f "$FILE" ]]; then - mpv "$FILE" + echo "Playing $FILE" + mpv "$FILE" else - firefox {{ emacsconf_caption_dir }}/assets/in-between/$SLUG.png + echo "Opening backup image {{ emacsconf_caption_dir }}/assets/in-between/$SLUG.png" + firefox {{ emacsconf_caption_dir }}/assets/in-between/$SLUG.png fi diff --git a/roles/prerec/templates/Makefile b/roles/prerec/templates/Makefile index d841cda..f58c5d6 100644 --- a/roles/prerec/templates/Makefile +++ b/roles/prerec/templates/Makefile @@ -67,7 +67,7 @@ emacsconf-%--main.opus: emacsconf-%--main.webm ffmpeg -y -i "$<" -c:a copy "$@" emacsconf-%--reencoded.vtt: emacsconf-%--reencoded.opus - whisperx --model large-v3 --align_model WAV2VEC2_ASR_LARGE_LV60K_960H --compute_type int8 --print_progress True --max_line_width 50 --segment_resolution chunk --max_line_count 1 --language en "$<" + whisperx --model large-v3 --align_model WAV2VEC2_ASR_LARGE_LV60K_960H --compute_type int8 --print_progress True --max_line_width 50 --segment_resolution chunk --max_line_count 1 --language en --initial_prompt "Transcribe this talk about Emacs. It may mention Emacs keywords such as Org Mode, Org Roam, Magit, gptel, or chatgpt-shell, or tech keywords such as LLMs. Format function names and keyboard shortcut sequences according to Emacs conventions using Markdown syntax. For example: control h becomes \`C-h\`." "$<" emacsconf-%--backstage--silences.csv: emacsconf-%--reencoded.opus ffmpeg -i "$<" -af silencedetect=noise=-30dB:d=0.5 -f null - 2>&1 | awk '/silence_start/ {start=$$NF} /silence_end/ {print start "," (start + $$NF)}' > "$@" diff --git a/roles/prerec/templates/process-prerec.sh b/roles/prerec/templates/process-prerec.sh index d0f5fa7..4347576 100755 --- a/roles/prerec/templates/process-prerec.sh +++ b/roles/prerec/templates/process-prerec.sh @@ -5,10 +5,11 @@ ORIGINAL=$1 REENCODED=$(echo "$ORIGINAL" | perl -pe 's/^(emacsconf-[0-9]*-.*?--.*?--.*?--).*/$1reencoded.webm/') SLUG=$(echo "$ORIGINAL" | perl -ne '/^emacsconf-[0-9]*-(.*?)--/ && print $1') MAIN=$(echo "$ORIGINAL" | perl -pe 's/^(emacsconf-[0-9]*-.*?--.*?--.*?--).*/$1main.webm/') -VTT=$(echo "$ORIGINAL" | perl -pe 's/^(emacsconf-[0-9]*-.*?--.*?--.*?--).*/$1main.vtt/') +VTT=$(echo "$ORIGINAL" | perl -pe 's/^(emacsconf-[0-9]*-.*?--.*?--.*?--).*/$1reencoded.vtt/') # ( cd /data/emacsconf/cache; ./update-cache ) # /data/emacsconf/admin/{{ emacsconf_year }}/scripts/talk $SLUG "WAITING_FOR_PREREC" "PROCESSING" if [[ ! -f "$REENCODED" ]]; then - screen -dmS reencode-$SLUG /bin/bash -c "reencode.sh \"$ORIGINAL\" \"$REENCODED\" && upload.sh $REENCODED $MAIN && thumbnail.sh \"$MAIN\" && upload.sh $(echo "$MAIN" | sed s/webm$/png/); echo $(date -Iminutes) $SLUG reencoded >> ~/emacsconf.log && exec /bin/bash" & + screen -dmS reencode-$SLUG /bin/bash -c "reencode.sh \"$ORIGINAL\" \"$REENCODED\" && make $MAIN && upload.sh $REENCODED $MAIN && thumbnail.sh \"$MAIN\" && upload.sh $(echo "$MAIN" | sed s/webm$/png/); echo $(date -Iminutes) $SLUG reencoded >> ~/emacsconf.log && make $VTT; echo $(date -Iminutes) $SLUG captioned >> ~/emacsconf.log; exec /bin/bash" & +else + screen -dmS captions-$SLUG /bin/bash -c "make $VTT; echo $(date -Iminutes) $SLUG captioned >> ~/emacsconf.log; exec /bin/bash" fi -screen -dmS captions-$SLUG /bin/bash -c "make $VTT; echo $(date -Iminutes) $SLUG captioned >> ~/emacsconf.log; exec /bin/bash" diff --git a/roles/prerec/templates/reencode.sh b/roles/prerec/templates/reencode.sh index 665fee2..ac5309a 100755 --- a/roles/prerec/templates/reencode.sh +++ b/roles/prerec/templates/reencode.sh @@ -10,6 +10,9 @@ print_only=false limit_resolution={{ res_y }} limit_fps={{ fps }} +output_final="${2:-$(echo $input | sed 's/--original.*/--reencoded.webm/')}" +output_temp="partial--${output_final}" # <-- New temporary name + while getopts :q:c:t:s OPT; do case $OPT in q|+q) @@ -47,7 +50,7 @@ ffmpeg -y -i "$input" $time_limit \ fps='$limit_fps'" \ -c:v libvpx-vp9 -b:v 0 -crf $q -c:a libopus \ -row-mt 1 -tile-columns 2 -tile-rows 2 -cpu-used $cpu \ - -pass 2 -threads $cpu -- "$output" + -pass 2 -threads $cpu -- "$output_temp" EOF )" @@ -55,4 +58,5 @@ if [ $print_only == true ]; then echo "$command" else eval "$command" + mv "$output_temp" "$output_final" fi diff --git a/roles/prerec/templates/upload.sh b/roles/prerec/templates/upload.sh index 09d55d9..03cc66a 100755 --- a/roles/prerec/templates/upload.sh +++ b/roles/prerec/templates/upload.sh @@ -2,5 +2,5 @@ # {{ ansible_managed }} scp $* orga@media.emacsconf.org:~/backstage -/usr/local/bin/publish-backstage-index.sh +# /usr/local/bin/publish-backstage-index.sh rsync -avze ssh orga@media.emacsconf.org:~/backstage/ /data/emacsconf/shared/{{ emacsconf_year }}/cache/ |
