Skip to content

Commit

Permalink
Minor fixes in shell scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
roleoroleo committed Apr 13, 2021
1 parent e8b1ca9 commit 2e450c4
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/static/static/home/yi-hack/script/system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ if [[ $(get_config DISABLE_CLOUD) == "no" ]] ; then
if [ $(get_config SPEAKER_AUDIO) != "no" ]; then
touch /tmp/audio_in_fifo.requested
fi
touch /tmp/audio_fifo.requested
touch /tmp/audio_in_fifo.requested
cd /home/app
LD_LIBRARY_PATH="/home/yi-hack/lib:/lib:/usr/lib:/home/lib:/home/qigan/lib:/home/app/locallib" ./rmm &
sleep 6
Expand Down Expand Up @@ -215,7 +213,12 @@ if [[ $(get_config ONVIF_WM_SNAPSHOT) == "yes" ]] ; then
fi

if [[ $(get_config RTSP) == "yes" ]] ; then
RRTSP_RES=$(get_config RTSP_STREAM) RRTSP_AUDIO=$(get_config RTSP_AUDIO) RRTSP_PORT=$RTSP_PORT RRTSP_USER=$USERNAME RRTSP_PWD=$PASSWORD rRTSPServer &
RTSP_AUDIO_COMPRESSION=$(get_config RTSP_AUDIO)
if [[ "$RTSP_AUDIO_COMPRESSION" == "none" ]] ; then
RTSP_AUDIO_COMPRESSION="no"
fi

RRTSP_RES=$(get_config RTSP_STREAM) RRTSP_AUDIO=$RTSP_AUDIO_COMPRESSION RRTSP_PORT=$RTSP_PORT RRTSP_USER=$USERNAME RRTSP_PWD=$PASSWORD rRTSPServer &
if [[ $(get_config RTSP_STREAM) == "low" ]]; then
ONVIF_PROFILE_1="--name Profile_1 --width 640 --height 360 --url rtsp://%s$D_RTSP_PORT/ch0_1.h264 --snapurl http://%s$D_HTTPD_PORT/cgi-bin/snapshot.sh?res=low$WATERMARK --type H264"
fi
Expand Down
7 changes: 6 additions & 1 deletion src/static/static/home/yi-hack/script/wd_rtsp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ get_config()

restart_rtsp()
{
RRTSP_RES=$(get_config RTSP_STREAM) RRTSP_AUDIO=$(get_config RTSP_AUDIO) RRTSP_PORT=$RTSP_PORT RRTSP_USER=$USERNAME RRTSP_PWD=$PASSWORD rRTSPServer &
RRTSP_RES=$(get_config RTSP_STREAM) RRTSP_AUDIO=$RTSP_AUDIO_COMPRESSION RRTSP_PORT=$RTSP_PORT RRTSP_USER=$USERNAME RRTSP_PWD=$PASSWORD rRTSPServer &
}

check_rtsp()
Expand Down Expand Up @@ -76,6 +76,11 @@ case $(get_config RTSP_PORT) in
*) RTSP_PORT=$(get_config RTSP_PORT) ;;
esac

RTSP_AUDIO_COMPRESSION=$(get_config RTSP_AUDIO)
if [[ "$RTSP_AUDIO_COMPRESSION" == "none" ]] ; then
RTSP_AUDIO_COMPRESSION="no"
fi

echo "$(date +'%Y-%m-%d %H:%M:%S') - Starting RTSP watchdog..." >> $LOG_FILE

while true
Expand Down
18 changes: 16 additions & 2 deletions src/www/httpd/cgi-bin/service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,25 @@ init_config()
if [[ $HTTPD_PORT != "80" ]] ; then
D_HTTPD_PORT=:$HTTPD_PORT
fi

if [[ $(get_config RTSP) == "yes" ]] ; then
RTSP_AUDIO_COMPRESSION=$(get_config RTSP_AUDIO)
if [[ "$RTSP_AUDIO_COMPRESSION" == "none" ]]; then
RTSP_AUDIO_COMPRESSION="no"
fi
fi
}

start_rtsp()
{
RRTSP_RES=$1 RRTSP_PORT=$RTSP_PORT RRTSP_USER=$USERNAME RRTSP_PWD=$PASSWORD rRTSPServer >/dev/null &
if [ ! -z $1 ]; then
RTSP_RES=$1
fi
if [ ! -z $2 ]; then
RTSP_AUDIO_COMPRESSION=$2
fi

RRTSP_RES=$RTSP_RES RRTSP_PORT=$RTSP_PORT RRTSP_USER=$USERNAME RRTSP_PWD=$PASSWORD RRTSP_AUDIO=$RTSP_AUDIO_COMPRESSION rRTSPServer >/dev/null &
$YI_HACK_PREFIX/script/wd_rtsp.sh >/dev/null &
}

Expand Down Expand Up @@ -153,7 +167,7 @@ init_config

if [ "$ACTION" == "start" ] ; then
if [ "$NAME" == "rtsp" ]; then
start_rtsp $PARAM1
start_rtsp $PARAM1 $PARAM2
elif [ "$NAME" == "onvif" ]; then
start_onvif $PARAM1 $PARAM2
elif [ "$NAME" == "wsdd" ]; then
Expand Down

0 comments on commit 2e450c4

Please sign in to comment.