From: Ian Kelling Date: Mon, 17 Jun 2024 13:12:45 +0000 (-0400) Subject: icecast improvements X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=989554cab0d0c59d1aab20496ba9550acd17e6e6;p=distro-setup icecast improvements --- diff --git a/brc2 b/brc2 index d46028d..104907e 100644 --- a/brc2 +++ b/brc2 @@ -4750,9 +4750,24 @@ ftoc() { 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 < AuthType Basic @@ -4769,8 +4784,23 @@ AuthUserFile "/etc/icecast-fsf-tech-htpasswd" Require valid-user 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 diff --git a/ffp b/ffp index 851506e..f956b06 100755 --- a/ffp +++ b/ffp @@ -74,10 +74,12 @@ esac -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=( @@ -89,7 +91,7 @@ opts=( -fast -fflags nobuffer -flags low_delay - -i http://$host/fsf$mount_suffix.webm + -i $host/fsf$mount_suffix.webm -autoexit ) ffplay "${opts[@]}" diff --git a/ffs b/ffs index 9efc9f0..d63668b 100755 --- a/ffs +++ b/ffs @@ -143,12 +143,22 @@ fi ##### 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/ *\([^<]*\).*/\1/p' /p/c/icecast.xml) @@ -360,8 +370,6 @@ if $watch; then rm -f $HOME/.iank-stream-on fi - - ### begin background/development docs ### # zmq vs stdin commands: diff --git a/ic-tmp-setup b/ic-tmp-setup index 84034f1..6192871 100755 --- a/ic-tmp-setup +++ b/ic-tmp-setup @@ -21,6 +21,6 @@ # 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 diff --git a/stream-interlude b/stream-interlude index 2fedf47..e3f1a4a 100755 --- a/stream-interlude +++ b/stream-interlude @@ -22,6 +22,22 @@ 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 @@ -47,7 +63,7 @@ ffmpeg-interlude() { # 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, @@ -60,6 +76,7 @@ ffmpeg-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 }