From da65206cc91887cf4aa85e6494cb06457c497c61 Mon Sep 17 00:00:00 2001 From: Sandesh C Date: Fri, 29 Jul 2016 00:02:29 +0530 Subject: added support to disable proxy while accessing WIFI_IP --- prepare-videochat.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/prepare-videochat.sh b/prepare-videochat.sh index 667cec9..b5d4847 100755 --- a/prepare-videochat.sh +++ b/prepare-videochat.sh @@ -154,6 +154,10 @@ WIFI_IP=192.168.2.140 # Port on which IP Webcam is listening PORT=8080 +# To disable proxy while acessing WIFI_IP (set value 1 to disable, 0 for not) +# For cases when host m/c is connected to a Proxy-Server and WIFI_IP belongs to local network +DISABLE_PROXY=0 + # Dimensions of video WIDTH=640 HEIGHT=480 @@ -241,7 +245,11 @@ url_reachable() { # has it in its core, so we don't need to check that case) sudo apt-get install -y curl fi - curl -m 5 -sI "$1" >/dev/null + if [ $DISABLE_PROXY = 1 ]; then + curl --noproxy '*' -m 5 -sI "$1" >/dev/null + else + curl -m 5 -sI "$1" >/dev/null + fi } send_intent() { @@ -526,6 +534,12 @@ fi # echo "$PIPELINE" +if [ $DISABLE_PROXY = 1 ]; then + # Disabling proxy to access WIFI_IP viz. on local network + temp_http_proxy=$http_proxy + unset http_proxy +fi + "$GSTLAUNCH" -e -vt --gst-plugin-spew \ --gst-debug="$GST_DEBUG" \ $PIPELINE \ @@ -553,5 +567,10 @@ pactl set-default-source ${DEFAULT_SOURCE} pactl unload-module ${ECANCEL_ID} pactl unload-module ${SINK_ID} +if [ $DISABLE_PROXY = 1 ]; then + # Renabling proxy on completion of the script + export http_proxy=$temp_http_proxy +fi + echo "Disconnected from IP Webcam. Have a nice day!" # idea: capture ctrl-c signal and set default source back -- cgit v1.2.3 From 191e7a4bdb82b843b3e0bc4f301eef0b8776932d Mon Sep 17 00:00:00 2001 From: Sandesh C Date: Mon, 1 Aug 2016 19:14:40 +0530 Subject: introduced a new parameter CURL_OPTIONS; removed unnecessary re-setting of http_proxy --- prepare-videochat.sh | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/prepare-videochat.sh b/prepare-videochat.sh index b5d4847..8a36a23 100755 --- a/prepare-videochat.sh +++ b/prepare-videochat.sh @@ -245,11 +245,12 @@ url_reachable() { # has it in its core, so we don't need to check that case) sudo apt-get install -y curl fi + + CURL_OPTIONS="" if [ $DISABLE_PROXY = 1 ]; then - curl --noproxy '*' -m 5 -sI "$1" >/dev/null - else - curl -m 5 -sI "$1" >/dev/null + CURL_OPTIONS="--noproxy $WIFI_IP" fi + curl $CURL_OPTIONS -m 5 -sI "$1" >/dev/null } send_intent() { @@ -536,7 +537,6 @@ fi if [ $DISABLE_PROXY = 1 ]; then # Disabling proxy to access WIFI_IP viz. on local network - temp_http_proxy=$http_proxy unset http_proxy fi @@ -567,10 +567,5 @@ pactl set-default-source ${DEFAULT_SOURCE} pactl unload-module ${ECANCEL_ID} pactl unload-module ${SINK_ID} -if [ $DISABLE_PROXY = 1 ]; then - # Renabling proxy on completion of the script - export http_proxy=$temp_http_proxy -fi - echo "Disconnected from IP Webcam. Have a nice day!" # idea: capture ctrl-c signal and set default source back -- cgit v1.2.3