summaryrefslogtreecommitdiffstats
path: root/roles/obs/templates/play
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2024-10-01 19:59:03 -0400
committerSacha Chua <sacha@sachachua.com>2024-10-01 19:59:03 -0400
commit2be81b299be9cad0b03495f2ea038a01969c6cb2 (patch)
tree6f798cdf8233d0c1079eaff3a52fd3bdabf8bdf7 /roles/obs/templates/play
parenta50799ae2d27ea57f9f470a9ecfb06dd77499c34 (diff)
downloademacsconf-ansible-2be81b299be9cad0b03495f2ea038a01969c6cb2.tar.xz
emacsconf-ansible-2be81b299be9cad0b03495f2ea038a01969c6cb2.zip
Update for new ansible version
Diffstat (limited to '')
-rwxr-xr-xroles/obs/templates/play58
-rwxr-xr-xroles/obs/templates/play-with-intro35
2 files changed, 65 insertions, 28 deletions
diff --git a/roles/obs/templates/play b/roles/obs/templates/play
index 20fd24c..22f58c7 100755
--- a/roles/obs/templates/play
+++ b/roles/obs/templates/play
@@ -2,19 +2,53 @@
# 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)
+
+/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
+
+# 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=($BASE_DIR/assets/stream/{{ 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..7f7865b 100755
--- a/roles/obs/templates/play-with-intro
+++ b/roles/obs/templates/play-with-intro
@@ -2,23 +2,26 @@
# 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
+
+# Play the intro if it exists. If it doesn't exist, switch to the intro slide and stop processing.
+
+if [[ -f $CACHE_DIR/$PREFIX--intro.webm ]]; then
+ mpv $CACHE_DIR/$PREFIX--intro.webm
+else
+ firefox --kiosk $BASE_DIR/assets/in-between/$SLUG.png
+ exit 0
fi
-mpv $FILE $* &
+
+/usr/local/bin/play $SLUG