summaryrefslogtreecommitdiffstats
path: root/roles/obs
diff options
context:
space:
mode:
Diffstat (limited to 'roles/obs')
-rw-r--r--roles/obs/defaults/main.yml4
-rw-r--r--roles/obs/tasks/main.yml35
-rw-r--r--roles/obs/tasks/obs-setup.yml8
-rw-r--r--roles/obs/tasks/track.yml15
-rwxr-xr-xroles/obs/templates/bbb6
-rw-r--r--roles/obs/templates/emacsconf-stream-config.el4
-rw-r--r--roles/obs/templates/i3-config2
-rwxr-xr-xroles/obs/templates/intro6
-rwxr-xr-xroles/obs/templates/music2
-rwxr-xr-xroles/obs/templates/overlay20
-rwxr-xr-xroles/obs/templates/play65
-rwxr-xr-xroles/obs/templates/play-with-intro34
-rw-r--r--roles/obs/templates/set-overlay20
-rwxr-xr-xroles/obs/templates/xstartup-track2
14 files changed, 139 insertions, 84 deletions
diff --git a/roles/obs/defaults/main.yml b/roles/obs/defaults/main.yml
index 6eb9451..d95b900 100644
--- a/roles/obs/defaults/main.yml
+++ b/roles/obs/defaults/main.yml
@@ -3,5 +3,7 @@ ff_vcustom: rt cpu-used=5 threads=2 error-resilient=1 crf=30 g=120 minrate=1.5M
ff_vbitrate: 1500
ff_vgopsize: 120
obs_profile_path: /home/{{ emacsconf_user }}/.config/obs-studio/basic/profiles
-emacsconf_asset_dir: /data/{{ emacsconf_id }}/assets
+emacsconf_asset_dir: /data/{{ emacsconf_id }}/shared/{{ emacsconf_year }}/assets
mumble_server: mumble.emacsconf.org
+background_music_dir: "{{ emacsconf_asset_dir }}/music"
+background_music_volume: 30
diff --git a/roles/obs/tasks/main.yml b/roles/obs/tasks/main.yml
index 249a0bb..5df7d56 100644
--- a/roles/obs/tasks/main.yml
+++ b/roles/obs/tasks/main.yml
@@ -49,9 +49,9 @@
dest: /etc/X11/xorg.conf
- name: Set up MPV and MPVC
tags: mpv
- include: mpv.yml
+ include_tasks: mpv.yml
- name: Set up track-specific things
- include: track.yml
+ include_tasks: track.yml
loop: "{{ emacsconf_tracks }}"
- debug:
var: emacsconf_home
@@ -82,14 +82,29 @@
line: export TZ={{ emacsconf_timezone }}
dest: "/home/{{ emacsconf_user }}/.bashrc"
- name: Allow sudo from {{ emacsconf_user }} to the stream users
+ tags: obs-sudo
become: true
become_user: root
- copy:
- content: |
- {% for item in emacsconf_tracks %}
- {{ emacsconf_user }} ALL=({{ emacsconf_id }}-{{ item.id }}) NOPASSWD: ALL
- {% endfor %}
- dest: /etc/sudoers.d/50_emacsconf
+ community.general.sudoers:
+ name: "{{ emacsconf_user }}-{{ emacsconf_id }}-{{ item.id }}"
+ user: "{{ emacsconf_user }}"
+ runas: "{{emacsconf_id }}-{{ item.id }}"
+ commands: ALL
+ nopassword: true
+ with_items:
+ - "{{ emacsconf_tracks }}"
+- name: Allow sudo from the stream users to the {{ emacsconf_user }}
+ tags: obs-sudo
+ become: true
+ become_user: root
+ community.general.sudoers:
+ name: "{{ emacsconf_id }}-{{ item.id }}-{{ emacsconf_user }}"
+ user: "{{emacsconf_id }}-{{ item.id }}"
+ runas: "{{ emacsconf_user }}"
+ commands: ALL
+ nopassword: true
+ with_items:
+ - "{{ emacsconf_tracks }}"
- name: Create directories
file:
owner: "{{ emacsconf_user }}"
@@ -106,9 +121,13 @@
loop:
- overlay
- music
+ - stop-music
- play
- play-with-intro
- intro
- bbb
- pad
+ - handle-qa
- handle-session
+ - reset-state
+ - rebroadcast
diff --git a/roles/obs/tasks/obs-setup.yml b/roles/obs/tasks/obs-setup.yml
index 5b0fba4..4e53e8c 100644
--- a/roles/obs/tasks/obs-setup.yml
+++ b/roles/obs/tasks/obs-setup.yml
@@ -71,11 +71,3 @@
loop:
- obs-track
- obs-cli-track
-- name: Fix permissions
- become: true
- become_user: root
- file:
- path: "~{{ emacsconf_user }}"
- owner: "{{ emacsconf_user }}"
- group: "{{ emacsconf_group }}"
- recurse: true
diff --git a/roles/obs/tasks/track.yml b/roles/obs/tasks/track.yml
index d615336..cbd4b39 100644
--- a/roles/obs/tasks/track.yml
+++ b/roles/obs/tasks/track.yml
@@ -9,10 +9,15 @@
var: emacsconf_home
- name: Set up user
tags: obs-track-scripts
- include: user.yml
+ include_tasks: user.yml
- name: Set up user-related things
become_user: "{{ emacsconf_user }}"
block:
+ - name: Set up symlink to current
+ file:
+ src: "~{{ old_emacsconf_user }}/current"
+ dest: "~{{ emacsconf_user }}/current"
+ state: link
- name: Set up track bins for addition to paths
file:
path: "~{{ emacsconf_user }}/bin/{{ item.id }}"
@@ -20,7 +25,7 @@
group: "{{ emacsconf_group }}"
state: directory
- name: Set up VNC
- include: tigervnc.yml
+ include_tasks: tigervnc.yml
- name: Create MPV profile directory
file:
path: "~{{ emacsconf_user }}/.config/mpv"
@@ -65,7 +70,7 @@
# shell: jackd -r -ddummy
# async: 2592000
- name: Set up pulse
- include: pulse.yml
+ include_tasks: pulse.yml
tags: pulse
- name: Set up I3 directory
file:
@@ -95,10 +100,10 @@
group: "{{ emacsconf_group }}"
- name: Set up Emacs configuration
tags: wip
- include: emacs.yml
+ include_tasks: emacs.yml
- name: Set up symbolic links
file:
- src: "/data/{{ emacsconf_id }}/assets/stream"
+ src: "/data/{{ emacsconf_id }}/shared/{{ emacsconf_year }}/assets/stream"
dest: "~{{ emacsconf_user }}/stream"
state: link
diff --git a/roles/obs/templates/bbb b/roles/obs/templates/bbb
index c12702c..b7c508f 100755
--- a/roles/obs/templates/bbb
+++ b/roles/obs/templates/bbb
@@ -3,17 +3,13 @@
# {{ ansible_managed }}
# Kill the background music if playing
-if screen -list | grep -q background; then
- screen -S background -X quit
-fi
+/usr/local/bin/reset-state
# Update the overlay
SLUG=$1
overlay $SLUG
-killall -s TERM firefox-esr
firefox https://media.emacsconf.org/{{ emacsconf_year }}/backstage/assets/redirects/open/bbb-$SLUG.html &
sleep 5
-xdotool search --class firefox windowactivate --sync
xdotool key Return
xdotool key F11
wait
diff --git a/roles/obs/templates/emacsconf-stream-config.el b/roles/obs/templates/emacsconf-stream-config.el
index bd5ffd7..2aa886b 100644
--- a/roles/obs/templates/emacsconf-stream-config.el
+++ b/roles/obs/templates/emacsconf-stream-config.el
@@ -13,7 +13,9 @@
(setq emacsconf-stream-track "{{ item.name }}")
(autoload 'text-property-search-forward "text-property-search")
(add-to-list 'load-path "~/emacsconf-el")
+(setq tab-width 2)
+(setq case-fold-search t)
+(setq emacsconf-cache-dir "{{ emacsconf_caption_dir }}/cache")
(require 'emacsconf)
(require 'emacsconf-stream)
(emacsconf-stream-display-clock-and-countdown)
-(setq tab-width 2)
diff --git a/roles/obs/templates/i3-config b/roles/obs/templates/i3-config
index 1787b64..31a7b40 100644
--- a/roles/obs/templates/i3-config
+++ b/roles/obs/templates/i3-config
@@ -23,7 +23,7 @@ font pango:monospace 8
# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# screen before suspend. Use loginctl lock-session to lock your screen.
-exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
+# exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
# NetworkManager is the most popular way to manage wireless networks on Linux,
# and nm-applet is a desktop environment-independent system tray GUI for it.
diff --git a/roles/obs/templates/intro b/roles/obs/templates/intro
index bf02dc3..7af9c4c 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 }}/assets/stream/emacsconf-{{ emacsconf_year }}-$FILE--*.webm)
+ LIST=({{ emacsconf_caption_dir }}/cache/emacsconf-{{ emacsconf_year }}-$FILE--*.webm)
FILE="${LIST[0]}"
BY_SLUG=1
else
@@ -16,8 +16,8 @@ else
fi
shift
overlay $SLUG
-if [[ -f {{ emacsconf_caption_dir }}/assets/intros/$SLUG.webm ]]; then
- mpv {{ emacsconf_caption_dir }}/assets/intros/$SLUG.webm
+if [[ -f "$FILE" ]]; then
+ mpv "$FILE"
else
firefox {{ emacsconf_caption_dir }}/assets/in-between/$SLUG.png
fi
diff --git a/roles/obs/templates/music b/roles/obs/templates/music
index 29c5ddb..a5a6a31 100755
--- a/roles/obs/templates/music
+++ b/roles/obs/templates/music
@@ -1,5 +1,5 @@
if screen -list | grep -q background; then
echo "Already running in screen, attach with screen -x background"
else
- screen -dmS background /bin/bash -c "mpv ~/stream/background.wav --loop=yes"
+ screen -dmS background /bin/bash -c "mpv {{ background_music_dir }}/* --shuffle --loop-playlist=inf --volume={{ background_music_volume }}"
fi
diff --git a/roles/obs/templates/overlay b/roles/obs/templates/overlay
index 1361884..0836a59 100755
--- a/roles/obs/templates/overlay
+++ b/roles/obs/templates/overlay
@@ -3,20 +3,20 @@
SLUG=$(echo "$1" | perl -ne 'if (/emacsconf-[0-9]*-(.*?)--/) { print $1; } else { print; }')
-if [[ -f {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-other.svg.png ]]; then
+if [[ -f {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-other.png ]]; then
echo "Found other overlay for $SLUG, copying"
- cp {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-other.svg.png ~/other.png
-elif [[ -f {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.svg.png ]]; then
+ cp {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-other.png ~/other.png
+elif [[ -f {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.png ]]; then
echo "Found video overlay for $SLUG, copying"
- cp {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.svg.png ~/other.png
+ cp {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.png ~/other.png
else
- echo "Could not find {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-other.svg.png, please override ~/other.png manually"
- cp {{ emacsconf_caption_dir }}/assets/overlays/blank-other.svg.png ~/other.png
+ echo "Could not find {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-other.png, please override ~/other.png manually"
+ cp {{ emacsconf_caption_dir }}/assets/overlays/blank-other.png ~/other.png
fi
-if [[ -f {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.svg.png ]]; then
+if [[ -f {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.png ]]; then
echo "Found video overlay for $SLUG, copying"
- cp {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.svg.png ~/video.png
+ cp {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.png ~/video.png
else
- echo "Could not find {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.svg.png, override ~/video.png manually"
- cp {{ emacsconf_caption_dir }}/assets/overlays/blank-video.svg.png ~/video.png
+ echo "Could not find {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.png, override ~/video.png manually"
+ cp {{ emacsconf_caption_dir }}/assets/overlays/blank-video.png ~/video.png
fi
diff --git a/roles/obs/templates/play b/roles/obs/templates/play
index 20fd24c..69632d4 100755
--- a/roles/obs/templates/play
+++ b/roles/obs/templates/play
@@ -2,19 +2,60 @@
# Play intro if recorded, then play files
# {{ ansible_managed }}
-# Kill the background music if playing
-if screen -list | grep -q background; then
- screen -S background -X quit
-fi
+shopt -s nullglob
+
+# play-with-intro $SLUG
+YEAR="{{ emacsconf_year }}"
+BASE_DIR="{{ emacsconf_caption_dir }}"
+CACHE_DIR="{{ emacsconf_caption_dir }}/cache"
+FIREFOX_NAME=firefox-esr
+SLUG=$1
+PREFIX=$(get-file-prefix $SLUG)
+PREFER_LIVE=$(jq -r ".talks[] | select(.slug == \"$SLUG\") | .\"prefer-live\" " < "$BASE_DIR/talks.json")
+/usr/local/bin/reset-state
# Update the overlay
-FILE=$1
-if [[ ! -f $FILE ]]; then
- LIST=({{ emacsconf_caption_dir }}/assets/stream/emacsconf-{{ emacsconf_year }}-$FILE*--main.webm)
+overlay $SLUG
+
+if [ "$PREFER_LIVE" = "t" ]; then
+ /usr/local/bin/bbb $SLUG
+ exit 0
+fi
+
+# Play the video if it exists. If it doesn't exist, switch to the BBB room and stop processing.
+if [ "x$TEST_MODE" = "x" ]; then
+ LIST=($CACHE_DIR/{{ emacsconf_id }}-{{ emacsconf_year }}-$SLUG*--main.webm)
+else
+ LIST=($BASE_DIR/assets/test/{{ emacsconf_id }}-{{ emacsconf_year }}-$SLUG*--main.webm)
+fi
+
+
+FILE="${LIST[0]}"
+# No file in the stream directory; check for original files in the stream directory, then check the cache
+NOSUB=""
+if [[ ! -f "$FILE" ]]; then
+ # Is there a cache file or an original file?
+ LIST=($CACHE_DIR/{{ emacsconf_id }}-{{ emacsconf_year }}-$SLUG*--main.webm)
FILE="${LIST[0]}"
- BY_SLUG=1
+ if [[ ! -f $FILE ]]; then
+ LIST=($CACHE_DIR/{{ emacsconf_id }}-{{ emacsconf_year }}-$SLUG*--original.*)
+ FILE="${LIST[0]}"
+ fi
+ echo "Candidate: " $FILE
+ SUBS=($CACHE_DIR/{{ emacsconf_id }}-{{ emacsconf_year }}-$SLUG*--main.vtt)
+ if [[ -f "${SUBS[0]}" ]]; then
+ if ! cat ${SUBS[0]} | head -1 | grep -q captioned ; then
+ echo "Skipping subtitles because they're not edited"
+ NOSUB="--sub-visibility=no"
+ else
+ NOSUB="--sub-visibility=yes"
+ fi
+ fi
+fi
+
+if [[ -f "$FILE" ]]; then
+ screen -mS talk /bin/bash -c "mpv $NOSUB $FILE"
+else
+ /usr/local/bin/bbb $SLUG
+ exit 0
fi
-shift
-SLUG=$(echo "$FILE" | perl -ne 'if (/emacsconf-[0-9]*-(.*?)--/) { print $1; } else { print; }')
-overlay $SLUG
-mpv $FILE $* &
diff --git a/roles/obs/templates/play-with-intro b/roles/obs/templates/play-with-intro
index 1b1b9a5..0390f8f 100755
--- a/roles/obs/templates/play-with-intro
+++ b/roles/obs/templates/play-with-intro
@@ -2,23 +2,21 @@
# Play intro if recorded, then play files
# {{ ansible_managed }}
-# Kill the background music if playing
-if screen -list | grep -q background; then
- screen -S background -X quit
-fi
+# play-with-intro $SLUG
+YEAR="{{ emacsconf_year }}"
+BASE_DIR="{{ emacsconf_caption_dir }}"
+CACHE_DIR="{{ emacsconf_caption_dir }}/cache"
+FIREFOX_NAME=firefox-esr
+SLUG=$1
+PREFIX=$(get-file-prefix $SLUG)
+
+/usr/local/bin/reset-state
# Update the overlay
-FILE=$1
-if [[ ! -f $FILE ]]; then
- LIST=({{ emacsconf_caption_dir }}/assets/stream/emacsconf-{{ emacsconf_year }}-$FILE*.webm)
- FILE="${LIST[0]}"
- BY_SLUG=1
-fi
-shift
-SLUG=$(echo "$FILE" | perl -ne 'if (/emacsconf-[0-9]*-(.*?)--/) { print $1; } else { print; }')
-overlay $SLUG
-# Play the video
-if [[ -f {{ emacsconf_caption_dir }}/assets/intros/$SLUG.webm ]]; then
- intro $SLUG
-fi
-mpv $FILE $* &
+/usr/local/bin/overlay $SLUG
+
+# Play the intro if it exists. If it doesn't exist, switch to the intro slide and stop processing.
+
+/usr/local/bin/intro $SLUG
+
+/usr/local/bin/play $SLUG
diff --git a/roles/obs/templates/set-overlay b/roles/obs/templates/set-overlay
index 0b6712b..8a408bf 100644
--- a/roles/obs/templates/set-overlay
+++ b/roles/obs/templates/set-overlay
@@ -6,20 +6,20 @@ if [[ ! -f $FILE ]]; then
fi
shift
SLUG=$(echo "$FILE" | perl -ne 'if (/^emacsconf-[0-9]*-(.*?)--/) { print $1; } else { print; }')
-if [[ -f {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-other.svg.png ]]; then
+if [[ -f {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-other.png ]]; then
echo "Found other overlay for $SLUG, copying"
- cp {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-other.svg.png ~/other.png
-elif [[ -f {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.svg.png ]]; then
+ cp {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-other.png ~/other.png
+elif [[ -f {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.png ]]; then
echo "Found video overlay for $SLUG, copying"
- cp {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.svg.png ~/other.png
+ cp {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.png ~/other.png
else
- echo "Could not find {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-other.svg.png, please override ~/other.png manually"
- cp {{ emacsconf_caption_dir }}/assets/overlays/blank-other.svg.png ~/other.png
+ echo "Could not find {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-other.png, please override ~/other.png manually"
+ cp {{ emacsconf_caption_dir }}/assets/overlays/blank-other.png ~/other.png
fi
-if [[ -f {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.svg.png ]]; then
+if [[ -f {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.png ]]; then
echo "Found video overlay for $SLUG, copying"
- cp {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.svg.png ~/video.png
+ cp {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.png ~/video.png
else
- echo "Could not find {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.svg.png, override ~/video.png manually"
- cp {{ emacsconf_caption_dir }}/assets/overlays/blank-video.svg.png ~/video.png
+ echo "Could not find {{ emacsconf_caption_dir }}/assets/overlays/$SLUG-video.png, override ~/video.png manually"
+ cp {{ emacsconf_caption_dir }}/assets/overlays/blank-video.png ~/video.png
fi
diff --git a/roles/obs/templates/xstartup-track b/roles/obs/templates/xstartup-track
index e09c081..f2f6716 100755
--- a/roles/obs/templates/xstartup-track
+++ b/roles/obs/templates/xstartup-track
@@ -5,7 +5,7 @@ export PATH="/usr/local/bin:/usr/bin:/bin:{{ emacsconf_home }}/bin"
xrdb $HOME/.Xresources
pulseaudio --start
pacmd set-default-sink qa
-firefox file:///data/emacsconf/{{ emacsconf_year }}/index-{{ item.id }}.html &
+firefox file:///data/emacsconf/admin/{{ emacsconf_year }}/index-{{ item.id }}.html &
$HOME/bin/track-obs &
mumble mumble://{{ emacsconf_id }}-{{ item.id }}@{{ mumble_server }}/{{ item.mumble_channel }} &
termit &