2 # I, Ian Kelling, follow the GNU license recommendations at
3 # https://www.gnu.org/licenses/license-recommendations.en.html. They
4 # recommend that small programs, < 300 lines, be licensed under the
5 # Apache License 2.0. This file contains or is part of one or more small
6 # programs. If a small program grows beyond 300 lines, I plan to switch
9 # Copyright 2024 Ian Kelling
11 # Licensed under the Apache License, Version 2.0 (the "License");
12 # you may not use this file except in compliance with the License.
13 # You may obtain a copy of the License at
15 # http://www.apache.org/licenses/LICENSE-2.0
17 # Unless required by applicable law or agreed to in writing, software
18 # distributed under the License is distributed on an "AS IS" BASIS,
19 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 # See the License for the specific language governing permissions and
21 # limitations under the License.
23 set -e; .
/usr
/local
/lib
/bash-bear
; set +e
31 webms
=(/var
/icecast
/*.webm
)
32 last
=$
(( ${#webms[@]} -1 ))
33 if (( last
>= 0 )); then
34 f
=${webms[$last]%.webm}.log
36 f
=/var
/icecast
/interlude.log
38 echo $off_on $EPOCHSECONDS >>$f
42 p
=$
(cat /p
/obs-ws-pass
)
43 if [[ -e /tmp
/no-obs-auto-scene-switch
]]; then
44 rm -f /tmp
/no-obs-auto-scene-switch
45 if [[ -s /tmp
/last-obs-i3-mark
]]; then
46 mark
=$
(cat /tmp
/last-obs-i3-mark
)
47 obs-cmd
-w obsws
://localhost
:4455/$p scene switch
$mark
50 touch /tmp
/no-obs-auto-scene-switch
51 obs-cmd
-w obsws
://localhost
:4455/$p scene switch interlude
57 f
=/tmp
/iank-ffmpeg-interlude-toggle
63 # note: get _6 from looking for "parsed" ffmpeg debug output.
64 zsend
-b tcp
://127.0.0.1:5557 Parsed_drawbox_6 t
0
65 zsend
-b tcp
://127.0.0.1:5557 Parsed_drawtext_7 reinit
"text=''"
69 # I started an attempt to track if I was muted before an interlude,
70 # but decided against it. Seems easier to handle unmuting with
71 # whatever normal process I have for it.
73 # muted=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk '{print $2}')
75 zsend Parsed_volume_1 volume
0
76 zsend
-b tcp
://127.0.0.1:5557 Parsed_drawbox_6 t fill
77 zsend
-b tcp
://127.0.0.1:5557 Parsed_drawtext_7 reinit
"text='$(date "+%H\
:%M
%Z
") - Be right back'"
85 if [[ $1 == -b ]]; then
89 out
=$
(printf "%s\n" "$*" | zmqsend
${zmq_args[@]} ||
:)
90 if [[ $out != "0 Success" ]]; then
91 i3-nagbar
-m "FAILED zmqsend: $*" -t error
-f "pango:monospace 30"
99 # if pgrep '^obs$' &>/dev/null; then