From 821b7b518d236a0e5495f17f3ab6f4030ad56fab Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 21 Feb 2023 02:11:00 +0100 Subject: [PATCH] update audiometer --- .../main.yml} | 0 roles/ffmpeg_command/tasks/main.yml | 7 ++++--- templates/audiometer.service.j2 | 6 ++++-- templates/audiometer.sh.j2 | 4 ++-- .../nginx/sites/test.winkekatze.tv_tls.conf | 17 +++++++++++++++++ 5 files changed, 27 insertions(+), 7 deletions(-) rename host_vars/{test.winkekatze.tv.yml => test.winkekatze.tv/main.yml} (100%) create mode 100644 templates/files/nginx/sites/test.winkekatze.tv_tls.conf diff --git a/host_vars/test.winkekatze.tv.yml b/host_vars/test.winkekatze.tv/main.yml similarity index 100% rename from host_vars/test.winkekatze.tv.yml rename to host_vars/test.winkekatze.tv/main.yml diff --git a/roles/ffmpeg_command/tasks/main.yml b/roles/ffmpeg_command/tasks/main.yml index 68179ac..8f171b4 100644 --- a/roles/ffmpeg_command/tasks/main.yml +++ b/roles/ffmpeg_command/tasks/main.yml @@ -2,18 +2,18 @@ - name: Make sure stream_input_url is set ansible.builtin.fail: msg: "Please define stream_input_url" - when: not stream_input_url | bool + when: stream_input_url == false - name: Make sure stream_name is set ansible.builtin.fail: msg: "Please define stream_name" - when: not stream_name | bool + when: stream_name == false - name: Create systemd service become: true ansible.builtin.template: src: 'templates/audiometer.service.j2' - dest: '/lib/systemd/system/audiometer.service.j2' + dest: '/lib/systemd/system/audiometer.service' mode: 0640 owner: root group: root @@ -29,3 +29,4 @@ mode: 0655 owner: video group: video + notify: Systemctl restart audiometer.service diff --git a/templates/audiometer.service.j2 b/templates/audiometer.service.j2 index a25c8c2..99df7dd 100644 --- a/templates/audiometer.service.j2 +++ b/templates/audiometer.service.j2 @@ -1,15 +1,17 @@ {{ ansible_managed | comment }} [Unit] -Description=create audiometer for {{ inventory_hstname }} +Description=create audiometer for {{ inventory_hostname }} After=network.target [Service] Type=simple Restart=always User=video -ExecStart=/opt/audiometer.sh +ExecStart=/bin/sh /opt/audiometer.sh ExecReload=/bin/kill -HUP $MAINPID +StartLimitBurst=2 +StartLimitInterval=8 [Install] WantedBy=multi-user.target diff --git a/templates/audiometer.sh.j2 b/templates/audiometer.sh.j2 index 201011c..b414e04 100644 --- a/templates/audiometer.sh.j2 +++ b/templates/audiometer.sh.j2 @@ -1,6 +1,6 @@ #!/bin/sh -ffmpeg -listen 1 -i {{ stream_input_url }} \ +ffmpeg -i {{ stream_input_url }} \ -nostats \ -loglevel repeat+level+info \ -filter_complex \ @@ -8,7 +8,7 @@ ffmpeg -listen 1 -i {{ stream_input_url }} \ [full_mix]framerate=fps=25[out]; \ [orig_scaled]drawtext=fontfile=/srv/www/{{ inventory_hostname }}/opensans.ttf:text={{ stream_name }}:fontcolor=white:fontsize=100:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/1.5[preview_overlay];\ [0:a:0]ebur128=video=1:size=640x480:meter=9:target=-16:gauge=shortterm[native][native_a]; [native_a]anullsink; \ - [native]drawtext=fontfile=/srv/www/{{ inventory_hostname }}/opensans.ttf:text=native:fontcolor=white:fontsize=60:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/1.5[native_overlay];\ + [native]drawtext=fontfile=/srv/www/{{ inventory_hostname }}/opensans.ttf:text=audio:fontcolor=white:fontsize=60:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/1.5[native_overlay];\ [0:a:0]showvolume=r=50:w=640:h=60:b=0:ds=log:dm=1.0[native_vu]; \ [preview_overlay][native_vu][native_overlay]vstack=inputs=3[full_mix] " \ -map "[out]" \ diff --git a/templates/files/nginx/sites/test.winkekatze.tv_tls.conf b/templates/files/nginx/sites/test.winkekatze.tv_tls.conf new file mode 100644 index 0000000..bad94cf --- /dev/null +++ b/templates/files/nginx/sites/test.winkekatze.tv_tls.conf @@ -0,0 +1,17 @@ +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + + server_name test.winkekatze.tv; + + include snippets/tls_parameters_{{ site.name }}.snippet.conf; + include snippets/tls_certificate_{{ site.name }}.snippet.conf; + include snippets/logging_{{ site.name }}.snippet.conf; + + root /srv/www/test.winkekatze.tv; + + location / { + charset utf-8; + try_files $uri $uri/ =404; + } +}