From 7b312d6a425f5242c404f21e2cbc93573f2d6be6 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Sat, 18 May 2013 05:14:27 +0000 Subject: [PATCH] new tarball, version, bug fixes on weather, also optimized speed for slow isps, and added a global that can be set in user / system configs to make a longer wget time out. Default is 8 seconds. This should take care of the failure from slow load issue reported. --- inxi | 30 +++++++++++++++++++----------- inxi.changelog | 16 ++++++++++++++++ 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/inxi b/inxi index 10af255..886fc4b 100755 --- a/inxi +++ b/inxi @@ -1,9 +1,9 @@ #!/usr/bin/env bash ######################################################################## #### Script Name: inxi -#### Version: 1.9.02 +#### Version: 1.9.03 #### Date: May 17 2013 -#### Patch Number: 03 +#### Patch Number: 00 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -212,6 +212,8 @@ PS_THROTTLED='' REPO_DATA='' SED_I='-i' # for gnu sed, will be set to -i '' for bsd sed SED_RX='-r' # for gnu sed, will be set to -E for bsd sed for backward compatibility +# change to less, or more if you have very slow connection +WGET_TIMEOUT=8 ### primary data array holders ## usage: 'A_' A_ALSA_DATA='' @@ -5825,7 +5827,7 @@ get_networking_wan_ip_data() # awk has bad regex handling so checking it with grep -E instead # ip=$( echo 2001:0db8:85a3:0000:0000:8a2e:0370:7334 | gawk --re-interval ' # ip=$( wget -q -O - $WAN_IP_URL | gawk --re-interval ' - ip=$( wget -t 1 -T 6 -q -O - $WAN_IP_URL | gawk --re-interval ' + ip=$( wget -t 1 -T $WGET_TIMEOUT -q -O - $WAN_IP_URL | gawk --re-interval ' { #gsub("\n","",$2") print $NF @@ -7971,10 +7973,10 @@ get_weather_data() local weather_spider='http://wunderground.com/' local data_grab_error='' wget_error=0 local b_test_loc=false b_test_weather=false b_debug=false + local test_dir="$HOME/bin/scripts/inxi/data/weather/" local test_location='location2.xml' test_weather='weather-feed.xml' local location_data='' location='' weather_data='' location_array_value='' a_location='' - local weather_array_value='' site_elevation='' - local testDir="$HOME/bin/scripts/inxi/data/weather/" + local weather_array_value='' site_elevation='' temp_array='' # first we get the location data, once that is parsed and handled, we move to getting the # actual weather data, assuming no errors @@ -7982,14 +7984,15 @@ get_weather_data() location=$ALTERNATE_WEATHER_LOCATION else if [[ $b_test_loc != 'true' ]];then - location_data=$( wget -q -t 1 -T 8 -O- $location_site || wget_error=$? ) + location_data=$( wget -q -t 1 -T $WGET_TIMEOUT -O- $location_site || wget_error=$? ) + log_function_data "$location_data" if [[ $wget_error -ne 0 ]];then data_grab_error="Error: location server up but download error - wget: $wget_error" fi wget_error=0 else - if [[ -f $testDir$test_location ]];then - location_data="$( cat $testDir$test_location )" + if [[ -f $test_dir$test_location ]];then + location_data="$( cat $test_dir$test_location )" else data_grab_error="Error: location xml local file not found." fi @@ -8088,6 +8091,7 @@ get_weather_data() echo -e "location array:\n${A_WEATHER_DATA[0]}" echo "location: $location" fi + log_function_data "location: $location" if [[ -z $location && -z $data_grab_error ]];then data_grab_error="Error: location data downloaded but no location detected." @@ -8096,13 +8100,14 @@ get_weather_data() # now either dump process or go on to get weather data if [[ -z $data_grab_error ]];then if [[ $b_test_weather != 'true' ]];then - weather_data="$( wget -q -t 1 -T 8 -O- $weather_feed"$location" || wget_error=$? )" + weather_data="$( wget -q -t 1 -T $WGET_TIMEOUT -O- $weather_feed"$location" || wget_error=$? )" if [[ $wget_error -ne 0 ]];then data_grab_error="Error: weather server up but download error - wget: $wget_error" fi + log_function_data "$weather_data" else - if [[ -f $testDir$test_weather ]];then - weather_data="$( cat $testDir$test_weather)" + if [[ -f $test_dir$test_weather ]];then + weather_data="$( cat $test_dir$test_weather)" else data_grab_error="Error: weather feed xml local file not found." fi @@ -8223,12 +8228,15 @@ get_weather_data() # now either dump process or go on to get weather data if [[ -n $data_grab_error ]];then A_WEATHER_DATA=$data_grab_error + log_function_data "data grab error: $data_grab_error" fi if [[ $b_debug == 'true' ]];then echo "site_elevation: $site_elevation" echo "${A_WEATHER_DATA[1]}" fi + temp_array=${A_WEATHER_DATA[@]} + log_function_data "A_WEATHER_DATA: $temp_array" eval $LOGFE } diff --git a/inxi.changelog b/inxi.changelog index 3aad22b..1c5c27d 100755 --- a/inxi.changelog +++ b/inxi.changelog @@ -1,3 +1,19 @@ +===================================================================================== +Version: 1.9.03 +Patch Version: 00 +Script Date: May 17 2013 +----------------------------------- +Changes: +----------------------------------- +new tarball, version, bug fixes on weather, also optimized speed for slow isps, and added +a global that can be set in user / system configs to make a longer wget time out. Default +is 8 seconds. + +This should take care of the failure from slow load issue reported. + +----------------------------------- +-- Harald Hope - Fri, 17 May 2013 22:07:29 -0700 + ===================================================================================== Version: 1.9.02 Patch Version: 00