units "tempF($1)" tempC
}
-# note: requires dns setup of live.iankelling.org, & if i'm home, port
-# forwarding in wrt-setup-local. todo: automate that.
-local-icecast() {
+# local icecast
+localic() {
+ local mod=false
+ cedit live /p/c/machine_specific/vps/filesystem/var/lib/bind/db.iankelling.org <<'EOF' || mod=true
+live CNAME b8.nz.
+EOF
+ if $mod; then
+ ip=$(ip r show default | sed -r 's/.*src ([^ ]*).*/\1/' | head -n1)
+ if [[ ! $ip ]] && timeout 1 ping -c 1 $ip; then
+ echo "error: failed to get ip: $ip" >&2
+ exit 1
+ fi
+ cat >/p/c/cmc-firewall-data-http <<EOF
+http_ip=$ip
+EOF
+ bindpush
+ wrt-setup
+ fi
web-conf -e ian@iankelling.org -f 8000 - apache2 live.iankelling.org <<'EOF'
<Location "/fsf.webm">
AuthType Basic
Require valid-user
</Location>
EOF
+ s cat /etc/letsencrypt/live/live.iankelling.org/{fullchain,privkey}.pem | s dd of=/etc/icecast2/fullchainpluskey.pem
+ ser start icecast2
+}
+# li icecast
+liic() {
+ cedit live /p/c/machine_specific/vps/filesystem/var/lib/bind/db.iankelling.org <<'EOF' || bindpush
+live A 72.14.176.105
+ AAAA 2600:3c00::f03c:91ff:fe6d:baf8
+EOF
+}
+# icecast rm -r
+icrmr() {
+ find /var/icecast -type f -delete
+ ssh li.b8.nz find /var/icecast -type f -delete
}
+
# obs screen switching of
obof() {
ls -l /tmp/no-obs-auto-scene-switch
-host=live.iankelling.org:8000
-if ip n show 10.2.0.1 | grep . &>/dev/null && \
- [[ $(dig +timeout=1 +short @10.2.0.1 -x 10.2.0.2 2>&1 ||:) == kd.b8.nz. ]]; then
- host=127.0.0.1:8000
+host=https://live.iankelling.org:443
+live_host=$(dig +timeout=1 +short @iankelling.org live.iankelling.org)
+vps_host=$(dig +timeout=1 +short iankelling.org)
+if [[ $live_host != "$vps_host" ]] && ip n show 10.2.0.1 | grep . &>/dev/null && \
+ [[ $(dig +timeout=1 +short @10.2.0.1 -x 10.2.0.2 2>&1 ||:) == kd.b8.nz. ]]; then
+ host=http://127.0.0.1:8000
fi
opts=(
-fast
-fflags nobuffer
-flags low_delay
- -i http://$host/fsf$mount_suffix.webm
+ -i $host/fsf$mount_suffix.webm
-autoexit
)
ffplay "${opts[@]}"
##### end command line parsing ########
-host=live.iankelling.org:443
-if ip n show 10.2.0.1 | grep . &>/dev/null && \
- [[ $(dig +timeout=1 +short @10.2.0.1 -x 10.2.0.2 2>&1 ||:) == kd.b8.nz. ]]; then
+host=live.iankelling.org:8443
+live_host=$(dig +timeout=1 +short @iankelling.org live.iankelling.org)
+vps_host=$(dig +timeout=1 +short iankelling.org)
+if [[ $live_host != "$vps_host" ]] && ip n show 10.2.0.1 | grep . &>/dev/null && \
+ [[ $(dig +timeout=1 +short @10.2.0.1 -x 10.2.0.2 2>&1 ||:) == kd.b8.nz. ]]; then
host=127.0.0.1:8000
+else
+ find_prefix="ssh live.iankelling.org"
+fi
+
+if $find_prefix find /var/icecast -type f | grep .; then
+ echo "warning: suggest clearing /var/icecast with icrmr or moving files. sleeping for 4 seconds"
+ sleep 4
fi
+
pass=$(sed -n 's/ *<source-password>\([^<]*\).*/\1/p' /p/c/icecast.xml)
rm -f $HOME/.iank-stream-on
fi
-
-
### begin background/development docs ###
# zmq vs stdin commands:
# limitations under the License.
set -e; . /usr/local/lib/bash-bear; set +e
-mkdir -p /t/ic
-chown icecast2:iank /t/ic
-chmod 775 /t/ic
+mkdir -p /var/icecast
+chown icecast2:iank /var/icecast
+chmod 775 /var/icecast
set -e; . /usr/local/lib/bash-bear; set +e
+shopt -s nullglob
+
+log() {
+ local off_on f
+ local -a webms
+ off_on=$1
+ webms=(/var/icecast/*.webm)
+ last=$(( ${#webms[@]} -1 ))
+ if (( last >= 0 )); then
+ f=${webms[$last]%.webm}.log
+ else
+ f=/var/icecast/interlude.log
+ fi
+ echo $off_on $EPOCHSECONDS >>$f
+}
+
obs-interlude() {
p=$(cat /p/obs-ws-pass)
if [[ -e /tmp/no-obs-auto-scene-switch ]]; then
# note: get _6 from looking for "parsed" ffmpeg debug output.
zsend -b tcp://127.0.0.1:5557 Parsed_drawbox_6 t 0
zsend -b tcp://127.0.0.1:5557 Parsed_drawtext_7 reinit "text=''"
-
+ log off
else
# I started an attempt to track if I was muted before an interlude,
zsend -b tcp://127.0.0.1:5557 Parsed_drawbox_6 t fill
zsend -b tcp://127.0.0.1:5557 Parsed_drawtext_7 reinit "text='$(date "+%H\:%M %Z") - Be right back'"
touch $f
+ log on
fi
}