Files
neutrino/src/nhttpd/web/scripts/api.sh
yjogol 068d6e6d6c Set SVN:keyword Date, Revision
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@428 e54a6e83-5905-42d5-8d5c-058d10e6a962
2010-02-27 05:52:05 +00:00

91 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
# -----------------------------------------------------------
# API Script (yjogol)
# for yWeb independent shell calls
# $Date$
# $Revision$
# -----------------------------------------------------------
API_VERSION_MAJOR="1"
API_VERSION_MINOR="0"
API_VERSION_TEXT="$API_VERSION_MAJOR.$API_VERSION_MINOR"
path_httpd=".."
path_scripts="$path_httpd/scripts"
path_usrbin="/var/bin"
path_sbin="/sbin"
path_config="/var/tuxbox/config"
path_tmp="/tmp"
streaming_client_status="$path_tmp/streaming_client"
# -----------------------------------------------------------
# udp control for neutrinoTV and yWeb LiveTV
do_udp_stream()
{
up="no"
if [ -e $path_usrbin/udpstreamts ]; then
up="$path_usrbin/udpstreamts"
else
if [ -e $path_sbin/udpstreamts ]; then
up="$path_sbin/udpstreamts"
fi
fi
case "$1" in
installed)
echo "$up" ;;
start)
shift 1
killall streamts
killall udpstreamts
echo $* > $streaming_client_status
trap "" 1;$up $* &
;;
stop)
killall udpstreamts
rm $streaming_client_status
echo "ok"
;;
kill_all_streams)
killall streamts
killall streampes
killall udpstreamts
rm $streaming_client_status
echo "ok"
;;
esac
}
# -----------------------------------------------------------
# Main
# -----------------------------------------------------------
case "$1" in
version)
echo $API_VERSION_TEXT ;;
udp_stream)
shift 1
do_udp_stream $*
;;
streaming_status)
if [ -e $streaming_client_status ]; then
cat $streaming_client_status
else
echo "Streams: "
ps | grep stream | grep -v grep | grep -v sh | cut -d " " -f 15
fi
;;
streaming_lock)
shift 1
echo $* > $streaming_client_status # first parameter should always be the ip of the client
echo "ok"
;;
streaming_unlock)
rm $streaming_client_status
echo "ok"
;;
*)
echo "[api.sh] Parameter wrong: $*" ;;
esac