From 76dc2733b810aa003d6d11b10d7588f0cc55bdac Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Sat, 18 May 2013 04:11:18 +0000 Subject: [PATCH] new version, new tarball, bug fix for weather --- inxi | 30 +++++++++++++++++------------- inxi.changelog | 12 ++++++++++++ 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/inxi b/inxi index 2e86dff..0f03a5d 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/usr/bin/env bash ######################################################################## #### Script Name: inxi -#### Version: 1.9.01 +#### Version: 1.9.02 #### Date: May 17 2013 #### Patch Number: 00 ######################################################################## @@ -7969,7 +7969,9 @@ get_weather_data() local location_site='http://geoip.ubuntu.com/lookup' local weather_feed='http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=' local weather_spider='http://wunderground.com/' - local data_grab_error='' wget_error=0 b_testing=false b_debug=false + local data_grab_error='' wget_error=0 + local b_test_loc=true b_test_weather=false b_debug=false + 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/" @@ -7979,7 +7981,7 @@ get_weather_data() if [[ -n $ALTERNATE_WEATHER_LOCATION ]];then location=$ALTERNATE_WEATHER_LOCATION else - if [[ $b_testing != 'true' ]];then + if [[ $b_test_loc != 'true' ]];then # make sure location site is up wget -q -t 1 -T 5 --spider $location_site || wget_error=$? # grab the location xml file @@ -7992,20 +7994,21 @@ get_weather_data() data_grab_error="Error: location server up but download error - wget: $wget_error" fi else - if [[ -f $testDir/my-location.xml ]];then - location_data="$( cat $testDir/my-location.xml)" + if [[ -f $testDir$test_location ]];then + location_data="$( cat $testDir$test_location )" else data_grab_error="Error: location xml local file not found." fi fi - if [[ -z $( grep -i '<|>\n<|g' <<< $location_data )" location_data="$( sed $SED_RX 's|><|>\ <|g' <<< $location_data )" + # echo -e "ld:\n$location_data" location_array_value=$( gawk ' function clean(data) { returnData="" @@ -8066,7 +8069,7 @@ get_weather_data() locationString = city ";" regionCode ";" regionName ";" countryName ";" countryCode ";" countryCode3 locationString = locationString ";" latitude "," longitude ";" postalCode ";" timeZone print locationString - }' <<< "$location_data" ) + }' <<< "$location_data" ) fi A_WEATHER_DATA[0]=$location_array_value IFS=";" @@ -8086,7 +8089,7 @@ get_weather_data() fi fi if [[ $b_debug == 'true' ]];then - echo "${A_WEATHER_DATA[0]}" + echo -e "location array:\n${A_WEATHER_DATA[0]}" echo "location: $location" fi @@ -8098,7 +8101,7 @@ get_weather_data() if [[ -n $data_grab_error ]];then A_WEATHER_DATA=$data_grab_error else - if [[ $b_testing != 'true' ]];then + if [[ $b_test_weather != 'true' ]];then wget -q -t 1 -T 5 --spider $weather_spider || wget_error=$? # grab the weather feed xml file if [[ $wget_error -eq 0 ]];then @@ -8110,8 +8113,8 @@ get_weather_data() data_grab_error="Error: weather server up but download error - wget: $wget_error" fi else - if [[ -f $testDir/weather-feed.xml ]];then - weather_data="$( cat $testDir/weather-feed.xml)" + if [[ -f $testDir$test_weather ]];then + weather_data="$( cat $testDir$test_weather)" else data_grab_error="Error: weather feed xml local file not found." fi @@ -8127,7 +8130,7 @@ get_weather_data() # we need to grab the location data from the feed for remote checks if [[ -n $ALTERNATE_WEATHER_LOCATION ]];then location_data=$( sed -e '//,//d' -e '/<\/display_location>/,/<\/current_observation>/d' <<< "$weather_data" ) - # echo "$location_data" + # echo -e "ld1:\n$location_data" A_WEATHER_DATA[0]=$( gawk ' function clean(data) { returnData="" @@ -8156,6 +8159,7 @@ get_weather_data() END { print city ";" state ";;;;" country }' <<< "$location_data" ) + # echo -e "location:\n${A_WEATHER_DATA[0]}" fi # clean off everything before/after observation_location diff --git a/inxi.changelog b/inxi.changelog index 8ae3490..3aad22b 100755 --- a/inxi.changelog +++ b/inxi.changelog @@ -1,3 +1,15 @@ +===================================================================================== +Version: 1.9.02 +Patch Version: 00 +Script Date: May 17 2013 +----------------------------------- +Changes: +----------------------------------- + +new version, new tarball, bug fix for weather +----------------------------------- +-- Harald Hope - Fri, 17 May 2013 21:10:21 -0700 + ===================================================================================== Version: 1.9.01 Patch Version: 00