LINUX.ORG.RU
ФорумTalks

SopCast


0

6

вот такой вот скриптик для просмотра спорта наваял на базе чего-то нагугленного.

Несколько топиков назад была тема про биатлон

#!/bin/bash
# Start streaming sopcast address $1 with sp-sc-auth, then start $PLAYER and monitor both processes.
# Author: Chickamade <anh.chick@gmail.com>
# pashazz <pzinin@gmail.com> - $PLAYER porting

PLAYER="smplayer" #your player

if ! test $# -eq 1
then
    echo 'Usage: sopcast <sop://address>'
    exit 0
fi

if pgrep -f "sp-sc-auth $1"
then
    echo sopcast: channel $1 already streaming, quitting >&2
    exit 0
fi

PORT=${1##*/}

echo sopcast: starting stream $1 on port $PORT >&2
#запуск sp-sc здесь
LD_PRELOAD="/path/to/libstdc++.so.5" /path/to/sp-sc-auth "$1" 3908 $PORT >/dev/null &
SP_SC=`pgrep -f "sp-sc-auth $1 3908 $PORT"`
if test -z $SP_SC
then
    echo sopcast: stream $1 failed to start >&2
    exit 1
fi

sleep 20

$PLAYER http://localhost:$PORT>/dev/null 2>&1 &
MPLAYER=`pgrep -f "$PLAYER http://localhost:$PORT"`
if test -z $MPLAYER
then
    echo sopcast: $PLAYER failed to start >&2
    kill -9 $SP_SC
    exit 1
fi

while true
do
    if ! ps $SP_SC > /dev/null
    then
        echo sopcast: stream $1 died, killing $PLAYER >&2
        kill $MPLAYER
        exit 1
    fi
    if ! ps $MPLAYER > /dev/null
    then
        echo sopcast: $PLAYER not running, killing stream $1 >&2
        kill -9 $SP_SC
        exit 0
    fi
    sleep 10
done
exit 0
★★★★

tnx. еще тогда сохранил.

dikiy ★★☆☆☆
()

пользуюсь таким вот :

 (./.sp-sc-auth sop://broker.sopcast.com:3912/79509 3908 8908 > /dev/null &); sleep 10; wait $(vlc http://localhost:8908/tv.asf); killall .sp-sc-auth
zibert ★★★
()

Может на wiki создать раздел с пользовательскими скриптами?

deterok ★★★★★
()
31 мая 2012 г.
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.