#!/bin/sh set -e -u SSH_URL=stream@ascii.town GIT_URL=git@ascii.town:stream.git welcome() { echo echo 'Welcome to Twinch dot ptee vee!' echo echo 'To view a public stream, run one of the following commands:' echo cd public for id in *; do echo " ssh -t $SSH_URL $id" done echo } start() { local id id=$(setup $1) echo echo 'Stream created!' echo echo 'To view the stream, run:' echo echo " ssh -t $SSH_URL $1" echo echo 'To broadcast to the stream, run:' echo echo " git clone $GIT_URL" echo " cd stream" echo " make ptee" echo " ./ptee | ssh $SSH_URL ingest $id" echo } if [ -z "${SSH_ORIGINAL_COMMAND:-}" ]; then welcome exit else set $SSH_ORIGINAL_COMMAND case $1 in start) start ${2##*/} ;; ingest) exec ingest private/${2##*/} ;; view) exec view public/${2##*/} ;; *) exec view public/${1##*/} ;; esac fi