fstream/client/watch
2023-11-01 08:20:12 +01:00

45 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
cd "$(dirname "$(realpath "$BASH_SOURCE")")"
function getValue() {
var="$1"
if ! [ "${!var}" == "" ]; then
return
fi
if [ "$3" == "fail" ]; then
echo "ERROR: $1 is not defined."
exit 1
fi
declare -g "$1"="$2"
}
# USER SETTINGS
getValue fstream_profile "profile_watch.sh"
source "$fstream_profile"
getValue fstream_ip "fier.me:61920" fail
getValue fstream_user "user" fail
getValue fstream_channel "default"
getValue fstream_channelpass ""
getValue fstream_python "python3"
getValue fstream_aespass ""
getValue fstream_aesbuffer "4096"
fstream_decodercmd=(
ffplay -avioflags direct -strict experimental -analyzeduration 0 -sync ext -probesize 32 -fflags nobuffer -flags low_delay -max_delay 0 -max_probe_packets 0 -x264opts intra-refresh=1 -fflags discardcorrupt -vf setpts=0 -
)
fstream_clientarg="watch,user=$fstream_user,channel=$fstream_channel,channel-password=$fstream_channelpass"
fstream_clientcmd=(
"$fstream_python" fstream.py
"$fstream_ip"
"$fstream_clientarg"
)
if [ "$fstream_aespass" == "" ]; then
"${fstream_clientcmd[@]}" | "${fstream_decodercmd[@]}"
else
"${fstream_clientcmd[@]}" | fstream_aespass="$fstream_aespass" fstream_aesbuffer="$fstream_aesbuffer" "$fstream_python" fstream-util-aes_to_pipe.py | "${fstream_decodercmd[@]}"
fi