Skip to content

Commit

Permalink
bw/bundles/loudness-rendering: allow updating room name without resta…
Browse files Browse the repository at this point in the history
…rting rendering
  • Loading branch information
kunsi committed Sep 21, 2024
1 parent a2c44f6 commit 910b4c5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions bundlewrap/bundles/loudness-rendering/files/loudness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
NAME="$1"
SOURCE="$2"
OUTPUT="$3"
ROOM="$4"

set -uo pipefail

Expand All @@ -18,6 +17,7 @@ fi
mkdir -p "/opt/loudness-rendering/data/${NAME}"
touch "/opt/loudness-rendering/data/${NAME}/line1.txt"
touch "/opt/loudness-rendering/data/${NAME}/line2.txt"
touch "/opt/loudness-rendering/data/${NAME}/line3.txt"

/usr/local/sbin/voc2alert "info" "loudness/${NAME}" "Loudness monitoring started ..."

Expand All @@ -39,7 +39,7 @@ ffmpeg \
[ov] drawtext='fontcolor=white:x=45:y=36:fontsize=50:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf:textfile=/opt/loudness-rendering/data/${NAME}/line1.txt:reload=30' [ov1];
[ov1] drawtext='fontcolor=white:x=45:y=86:fontsize=20:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf:textfile=/opt/loudness-rendering/data/${NAME}/line2.txt:reload=30' [ov2];
[ov2] drawtext='fontcolor=white:x=45:y=111:fontsize=20:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf:text=${NAME}' [ov3];
[ov3] drawtext='fontcolor=white:x=45:y=303:fontsize=50:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf:text=${ROOM}' [out]" \
[ov3] drawtext='fontcolor=white:x=45:y=303:fontsize=50:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf:textfile=/opt/loudness-rendering/data/${NAME}/line3.txt:reload=30' [out]" \
-map "[out]" -c:v libx264 -threads 2 -preset veryfast -x264-params keyint=30 -tune zerolatency -crf:0 26 -profile:0 high -level:0 4.1 -strict -2 -pix_fmt yuv420p \
-map "[audio]" -c:a aac -b:a 128k \
-f flv \
Expand Down
2 changes: 1 addition & 1 deletion bundlewrap/bundles/loudness-rendering/files/service
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ After=network.target
Type=simple
User=voc
Group=voc
ExecStart=/usr/local/bin/loudness_rendering "${identifier}" "${source_url}" "${output}" "${room_name}"
ExecStart=/usr/local/bin/loudness_rendering "${identifier}" "${source_url}" "${output}"
Restart=always
RestartSec=10
StartLimitInterval=0
Expand Down
5 changes: 4 additions & 1 deletion bundlewrap/bundles/loudness-rendering/files/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@
with open(os.path.join(DATA_DIR, stream, 'line2.txt.tmp'), 'w+') as f:
f.write(' - '.join(line2))

for i in ('line1', 'line2'):
with open(os.path.join(DATA_DIR, stream, 'line3.txt.tmp'), 'w+') as f:
f.write(config['streams'][stream]['room'])

for i in ('line1', 'line2', 'line3'):
os.replace(
os.path.join(DATA_DIR, stream, f'{i}.txt.tmp'),
os.path.join(DATA_DIR, stream, f'{i}.txt'),
Expand Down
1 change: 0 additions & 1 deletion bundlewrap/bundles/loudness-rendering/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
'source': 'service',
'content_type': 'mako',
'context': {
'room_name': config['room'],
'source_url': config['source'],
'identifier': stream,
'output': config['output'],
Expand Down

0 comments on commit 910b4c5

Please sign in to comment.