Add support for dynamic weather icon in Default mode #28

Merged
merged 1 commit into from Sep 28, 2012
View
12 conkycolors/bin/conkyYahooWeather
@@ -5,6 +5,7 @@ MIN="min"
MAX="max"
CUR="cur"
UNIT="c"
+CODE="code"
if [ "$1" = "$CUR" ]; then
if [ "$3" = "$UNIT" ]; then
@@ -16,4 +17,15 @@ elif [ "$1" = "$MAX" ]; then
curl -s --connect-timeout 30 "http://weather.yahooapis.com/forecastrss?p=$2&u=$3" | sed '/Current\ Conditions/,$!d' | sed -e 's/<[^>]*>//g' | sed '4!d' | sed 's/^.*High: //' | sed 's/ Low.*$//'
elif [ "$1" = "$MIN" ]; then
curl -s --connect-timeout 30 "http://weather.yahooapis.com/forecastrss?p=$2&u=$3" | sed '/Current\ Conditions/,$!d' | sed -e 's/<[^>]*>//g' | sed '4!d' | sed 's/^.*Low: //'
+elif [ "$1" = "$CODE" ]; then
+YAHOOCODE=$(curl -s --connect-timeout 30 "http://weather.yahooapis.com/forecastrss?p=$2&u=$3" | sed '/<yweather:condition/,1!d' | sed 's/.*code="\([^"]*\)".*/\1/')
+WEATHERCHAR=(1 2 3 n m x x y s h t h i p p 8 q u w 7 0 9 4 6 6 - f D d C c A a B b v 5 k k g j o r r - G 0 K)
+if [ "$YAHOOCODE" == "na" ]; then
+ echo "-"
+elif [ "$YAHOOCODE" == "-" ]; then
+ echo "-"
+else
+ echo ${WEATHERCHAR[$YAHOOCODE]}
fi
+fi
+
View
BIN fonts/conkycolors/ConkyWeather.ttf
Binary file not shown.