diff options
Diffstat (limited to '')
-rw-r--r-- | roles/stream/templates/emacsconf.nginx.conf | 2 | ||||
-rw-r--r-- | roles/stream/templates/icecast.xml | 32 | ||||
-rwxr-xr-x | roles/stream/templates/screen-fallback.sh | 11 | ||||
-rwxr-xr-x | roles/stream/templates/screen-fallbacks | 6 | ||||
-rwxr-xr-x | roles/stream/templates/screen-restream.sh | 2 |
5 files changed, 49 insertions, 4 deletions
diff --git a/roles/stream/templates/emacsconf.nginx.conf b/roles/stream/templates/emacsconf.nginx.conf index 277c833..ac84ef5 100644 --- a/roles/stream/templates/emacsconf.nginx.conf +++ b/roles/stream/templates/emacsconf.nginx.conf @@ -1,4 +1,4 @@ -location ~ ^/((gen|dev)(-480p)?.webm)$ { +location ~ ^/((gen|dev)(-480p|-fallback)?.webm)$ { proxy_pass http://127.0.0.1:{{ icecast_port }}/$1; proxy_http_version 1.1; proxy_buffering off; diff --git a/roles/stream/templates/icecast.xml b/roles/stream/templates/icecast.xml index d97a515..06830d3 100644 --- a/roles/stream/templates/icecast.xml +++ b/roles/stream/templates/icecast.xml @@ -200,6 +200,8 @@ <public>1</public> <on-connect>/usr/local/bin/{{ emacsconf_id }}-lowres-{{ track.id }}-on-connect</on-connect> <on-disconnect>/usr/local/bin/{{ emacsconf_id }}-lowres-{{ track.id }}-on-disconnect</on-disconnect> + <fallback-mount>/{{ track.id }}-sorry.webm</fallback-mount> + <fallback-override>1</fallback-override> </mount> <mount type="normal"> <mount-name>/{{ track.id }}-host.webm</mount-name> @@ -221,6 +223,32 @@ <stream-url>{{ track.watch_lowres }}</stream-url> <type>video/webm</type> <public>1</public> + <fallback-mount>/{{ track.id }}-480p-sorry.webm</fallback-mount> + <fallback-override>1</fallback-override> + </mount> + <mount type="normal"> + <mount-name>/{{ track.id }}-sorry.webm</mount-name> + <username>{{ icecast_emacsconf_user }}</username> + <password>{{ icecast_emacsconf_password }}</password> + <stream-name>EmacsConf {{ emacsconf_year }} - {{ track.name }} - fallback track</stream-name> + <stream-description>The fallback stream for the {{ track.name }} track of {{ emacsconf_name }} {{ emacsconf_year }}</stream-description> + <stream-url>{{ track.watch }}</stream-url> + <type>video/webm</type> + <public>1</public> + <hidden>1</hidden> + <!--fallback-mount>/{{ track.id }}-fallback.webm</fallback-mount--> + </mount> + <mount type="normal"> + <mount-name>/{{ track.id }}-480p-sorry.webm</mount-name> + <username>{{ icecast_emacsconf_user }}</username> + <password>{{ icecast_emacsconf_password }}</password> + <stream-name>EmacsConf {{ emacsconf_year }} - {{ track.name }} - fallback track</stream-name> + <stream-description>The low-res fallback stream for the {{ track.name }} track of {{ emacsconf_name }} {{ emacsconf_year }}</stream-description> + <stream-url>{{ track.watch }}</stream-url> + <type>video/webm</type> + <public>1</public> + <hidden>1</hidden> + <!--fallback-mount>/{{ track.id }}-fallback.webm</fallback-mount--> </mount> {% endfor %} {% if icecast_mounts is defined %} @@ -279,8 +307,8 @@ </paths> <logging> - <accesslog>access.log</accesslog> - <errorlog>error.log</errorlog> + <accesslog>emacsconf-access.log</accesslog> + <errorlog>emacsconf-error.log</errorlog> <!-- <playlistlog>playlist.log</playlistlog> --> <loglevel>3</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error --> <logsize>10000</logsize> <!-- Max size of a logfile --> diff --git a/roles/stream/templates/screen-fallback.sh b/roles/stream/templates/screen-fallback.sh new file mode 100755 index 0000000..9d816ba --- /dev/null +++ b/roles/stream/templates/screen-fallback.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# {{ ansible_managed }} + +SCREEN_NAME=fallback-{{ mount }} +if screen -S $SCREEN_NAME -Q select ; then + echo "Already running; screen -S $SCREEN_NAME -X quit if you need to restart" +else + echo {{ filename }} - {{ mount }} + screen -dmS $SCREEN_NAME ffmpeg -r 20 -re -fflags +genpts -stream_loop -1 -i /usr/share/icecast2/web/{{ filename }} -map_metadata -1 -f webm -content_type video/webm -c:a copy -c:v copy icecast://{{ icecast_emacsconf_user }}:{{ icecast_emacsconf_password }}@localhost:8001/{{ mount }} + echo "Started screen; connect with screen -x $SCREEN_NAME" +fi diff --git a/roles/stream/templates/screen-fallbacks b/roles/stream/templates/screen-fallbacks new file mode 100755 index 0000000..ade40e1 --- /dev/null +++ b/roles/stream/templates/screen-fallbacks @@ -0,0 +1,6 @@ +#!/bin/bash +# {{ ansible_managed }} +{% for track in emacsconf_tracks %} +/usr/local/bin/screen-fallback-{{ track.id }} & +/usr/local/bin/screen-fallback-{{ track.id }}-480p & +{% endfor %} diff --git a/roles/stream/templates/screen-restream.sh b/roles/stream/templates/screen-restream.sh index 7466c48..e25f574 100755 --- a/roles/stream/templates/screen-restream.sh +++ b/roles/stream/templates/screen-restream.sh @@ -5,6 +5,6 @@ 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 + screen -dmS $SCREEN_NAME /usr/local/bin/restream-{{ item[1].name }}-{{ item[0].name }} echo "Started screen; connect with screen -x $SCREEN_NAME" fi |