summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-11-24 10:12:59 -0500
committerSacha Chua <sacha@sachachua.com>2022-11-24 10:12:59 -0500
commit1a07538253b49a1e12df144f2c005898d52be99f (patch)
treea158f4885ec1e3a7b1e6182c702745d23cd85a80 /roles
parent1957b894290bcbee8767f6cd11d24927c21cdf9a (diff)
downloademacsconf-ansible-1a07538253b49a1e12df144f2c005898d52be99f.tar.xz
emacsconf-ansible-1a07538253b49a1e12df144f2c005898d52be99f.zip
restream, go back to old mount structure
Diffstat (limited to 'roles')
-rwxr-xr-xroles/obs/templates/start-background-music5
-rw-r--r--roles/stream/tasks/main.yml15
-rw-r--r--roles/stream/templates/icecast.xml8
-rwxr-xr-xroles/stream/templates/restream.sh1
-rwxr-xr-xroles/stream/templates/screen-restream.sh10
5 files changed, 35 insertions, 4 deletions
diff --git a/roles/obs/templates/start-background-music b/roles/obs/templates/start-background-music
new file mode 100755
index 0000000..af28208
--- /dev/null
+++ b/roles/obs/templates/start-background-music
@@ -0,0 +1,5 @@
+if screen -list | grep -q background; then
+ echo "Already running in screen, attach with screen -x background"
+else
+ screen -S background /bin/bash -c "mpv ~/stream/background.wav --loop=yes"
+fi
diff --git a/roles/stream/tasks/main.yml b/roles/stream/tasks/main.yml
index 941ac92..b2bbc69 100644
--- a/roles/stream/tasks/main.yml
+++ b/roles/stream/tasks/main.yml
@@ -1,3 +1,8 @@
+- name: Install at for scheduling commands
+ become: true
+ package:
+ name: at
+ state: present
- name: Install Icecast
become: true
package:
@@ -62,3 +67,13 @@
owner: orga
mode: 0755
loop: "{{ restreaming_platforms | subelements('streams') | list }}"
+ no_log: True
+- name: Set up restream scripts
+ tags: restream
+ template:
+ src: screen-restream.sh
+ dest: /home/orga/screen-restream-{{ item[1].name }}-{{ item[0].name }}.sh
+ owner: orga
+ mode: 0755
+ loop: "{{ restreaming_platforms | subelements('streams') | list }}"
+ no_log: True
diff --git a/roles/stream/templates/icecast.xml b/roles/stream/templates/icecast.xml
index cf6ec41..37e1a0a 100644
--- a/roles/stream/templates/icecast.xml
+++ b/roles/stream/templates/icecast.xml
@@ -169,7 +169,7 @@
<header name="Access-Control-Allow-Origin" value="http://webplayer.example.org" />
<header name="baz" value="quux" />
</http-headers>
- <on-connect>/home/icecast/bin/stream-start</on-connect>
+ <on-connect>/home/icecast/bin/stream-startg</on-connect>
<on-disconnect>/home/icecast/bin/stream-stop</on-disconnect>
</mount>
-->
@@ -189,7 +189,7 @@
-->
{% for track in emacsconf_tracks %}
<mount type="normal">
- <mount-name>/{{ track.id }}.webm</mount-name>
+ <mount-name>/{{ emacsconf_id }}/{{ track.id }}.webm</mount-name>
<username>{{ icecast_emacsconf_user }}</username>
<password>{{ icecast_emacsconf_password }}</password>
{% if icecast_save_dump %}<dump-file>/data/{{ emacsconf_id }}-{{ emacsconf_year }}-{{ track.id }}_%Y-%m-%d_%H-%M-%S.webm</dump-file>{% endif %}
@@ -202,7 +202,7 @@
<on-disconnect>/usr/local/bin/{{ emacsconf_id }}-lowres-{{ track.id }}-on-disconnect</on-disconnect>
</mount>
<mount type="normal">
- <mount-name>/{{ track.id }}-host.webm</mount-name>
+ <mount-name>/{{ emacsconf_id }}/{{ track.id }}-host.webm</mount-name>
<username>{{ icecast_emacsconf_user }}</username>
<password>{{ icecast_emacsconf_password }}</password>
<stream-name>EmacsConf {{ emacsconf_year }} - {{ track.name }} track</stream-name>
@@ -213,7 +213,7 @@
<hidden>1</hidden>
</mount>
<mount type="normal">
- <mount-name>/{{ track.id }}-480p.webm</mount-name>
+ <mount-name>/{{ emacsconf_id }}/{{ track.id }}-480p.webm</mount-name>
<username>{{ icecast_emacsconf_user }}</username>
<password>{{ icecast_emacsconf_password }}</password>
<stream-name>{{ emacsconf_name }} {{ emacsconf_year }} - {{ track.name }} track (480p)</stream-name>
diff --git a/roles/stream/templates/restream.sh b/roles/stream/templates/restream.sh
index e1d0a7f..81970c7 100755
--- a/roles/stream/templates/restream.sh
+++ b/roles/stream/templates/restream.sh
@@ -1,5 +1,6 @@
#!/bin/bash
# {{ ansible_managed }}
+# echo $$ > /tmp/restream-{{ item[1].key }}.pid
MOUNT={{ item[0].stream_url }}/{{ item[1].key }} # rtmp://..../stream_key
LOGLEVEL="${LOGLEVEL:-24}"
for i in 1 2 3 4 5; do
diff --git a/roles/stream/templates/screen-restream.sh b/roles/stream/templates/screen-restream.sh
new file mode 100755
index 0000000..7466c48
--- /dev/null
+++ b/roles/stream/templates/screen-restream.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+# {{ ansible_managed }}
+
+SCREEN_NAME=restream-{{ item[1].name }}-{{ item[0].name }}
+if screen -S $SCREEN_NAME -Q select ; then
+ echo "Already restreaming; screen -S $SCREEN_NAME -X quit if you need to restart"
+else
+ screen -dmS $SCREEN_NAME /home/{{ emacsconf_user }}/restream-{{ item[1].name }}-{{ item[0].name }}e.sh
+ echo "Started screen; connect with screen -x $SCREEN_NAME"
+fi