Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add support for dynamic weather icon in Default mode #28

Merged
merged 1 commit into from

2 participants

android-808 Helmuth Saatkamp
android-808
Collaborator

The Yahoo weather page that is currently used also contains a code to describe the current conditions. This patch matches that code against a glyph stored in the ConkyWeather.ttf font. The mapping between the font and the API code is obtained from here:
http://bazaar.launchpad.net/~conky-companions/+junk/conkyforecast/view/head:/conkyForecast.py#L225

Fixes #27

android-808 android-808 Add support for dynamic weather icon in Default mode
The Yahoo weather page that is currently used also contains a code to describe the current conditions.  This patch matches that code against a glyph stored in the ConkyWeather.ttf font.  The mapping between the font and the API code is obtained from here:
http://bazaar.launchpad.net/~conky-companions/+junk/conkyforecast/view/head:/conkyForecast.py#L225
4febb77
Helmuth Saatkamp helmuthdu merged commit 86691b9 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 28, 2012
  1. android-808

    Add support for dynamic weather icon in Default mode

    android-808 authored
    The Yahoo weather page that is currently used also contains a code to describe the current conditions.  This patch matches that code against a glyph stored in the ConkyWeather.ttf font.  The mapping between the font and the API code is obtained from here:
    http://bazaar.launchpad.net/~conky-companions/+junk/conkyforecast/view/head:/conkyForecast.py#L225
This page is out of date. Refresh to see the latest.
12 conkycolors/bin/conkyYahooWeather
View
@@ -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
+
BIN  fonts/conkycolors/ConkyWeather.ttf
View
Binary file not shown
Something went wrong with that request. Please try again.