summaryrefslogtreecommitdiff
path: root/bin/stream
diff options
context:
space:
mode:
Diffstat (limited to 'bin/stream')
-rwxr-xr-xbin/stream48
1 files changed, 25 insertions, 23 deletions
diff --git a/bin/stream b/bin/stream
index c10901f..db1c100 100755
--- a/bin/stream
+++ b/bin/stream
@@ -7,10 +7,35 @@ set -eu
# TODO: Externalize to site-specific configfile
[ $# -gt 0 ] || set -- morla 5002 -- dvcam ../../content/icon_small.png
+##
+## generic functions
+##
exit1() {
echo >&2 "ERROR: $1"
exit 1
}
+# shellcheck disable=SC2048,SC2059
+echo_n() {
+ printf -- "$*"
+}
+# shellcheck disable=SC2048,SC2059
+printf_each() {
+ skel=$1; shift
+ for string in $*; do
+ printf -- "$skel" "$string"
+ done
+}
+uniqwords() {
+ echo_n "$@" | tr ' ' '\012' | sort -u
+}
+valuedargcount() {
+ nonempty=
+ while [ $# -gt 0 ]; do
+ [ -z "$1" ] || nonempty=$((nonempty+1))
+ shift
+ done
+ echo_n "$nonempty"
+}
while [ $# -gt 0 ]; do
case $1 in
@@ -130,29 +155,6 @@ fi
[ -n "$HEIGHTS_MPEG" ] || SPEED_VP8="$SPEED_VP8_ALONE"
[ -n "$HEIGHTS_WEBM" ] || SPEED_X264="$SPEED_X264_ALONE"
-# shellcheck disable=SC2048,SC2059
-echo_n() {
- printf -- "$*"
-}
-# shellcheck disable=SC2048,SC2059
-printf_each() {
- skel=$1; shift
- for string in $*; do
- printf -- "$skel" "$string"
- done
-}
-uniqwords() {
- echo_n "$@" | tr ' ' '\012' | sort -u
-}
-valuedargcount() {
- nonempty=
- while [ $# -gt 0 ]; do
- [ -z "$1" ] || nonempty=$((nonempty+1))
- shift
- done
- echo_n "$nonempty"
-}
-
HEIGHTS=$(uniqwords "$HEIGHTS_WEBM $HEIGHTS_MPEG")
[ -z "${SAVEDIR:-}" ] || SAVESTEM="${SAVEDIR:-}/$(date +%Y%m%d-%H%M%S)"