From fa2a7ab41feebafe78466e4566cf3b8275b54366 Mon Sep 17 00:00:00 2001 From: ecyrbe Date: Thu, 26 May 2011 23:48:24 +0200 Subject: [PATCH] Add alternative displayed city The yahaoo forecast woeid doesn't always match your tiny town name we really need a configuration file or a gsettings schemas to put all this outside of the code --- README | 9 +++++++-- README.md | 3 ++- src/extension.js | 5 +++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README b/README index 3ab8c38..4909757 100644 --- a/README +++ b/README @@ -4,10 +4,15 @@ gnome-shell-extension-weather is a simple extension for displaying weather notif Currently, the weather report including forecast for today and tomorrow is fetched from [Yahoo](http://weather.yahoo.com/). +### Screenshot + +![Screenshot](https://github.com/ecyrbe/gnome-shell-extension-weather/raw/master/data/screenshot.png) + ### Installation 1. Change `YAHOO_ID` to your location in extension.js (cf. [WOEID](http://developer.yahoo.com/geo/geoplanet/guide/concepts.html)) -2. from command line run the following commands : +2. chage the 'CITY_DIPLAYED' to the real name of your location as the WOEID doesn't always match your tiny town +3. from command line run the following commands : > ./autogen.sh --prefix="/usr" > make > sudo make install @@ -17,7 +22,7 @@ Currently, the weather report including forecast for today and tomorrow is fetch ### Licence Copyright (C) 2011 -ecyrbe //remove +spam to email +Ecyrbe , Timur Kristóf , Elad Alfassa , Simon Legner diff --git a/README.md b/README.md index 71d4639..4909757 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,8 @@ Currently, the weather report including forecast for today and tomorrow is fetch ### Installation 1. Change `YAHOO_ID` to your location in extension.js (cf. [WOEID](http://developer.yahoo.com/geo/geoplanet/guide/concepts.html)) -2. from command line run the following commands : +2. chage the 'CITY_DIPLAYED' to the real name of your location as the WOEID doesn't always match your tiny town +3. from command line run the following commands : > ./autogen.sh --prefix="/usr" > make > sudo make install diff --git a/src/extension.js b/src/extension.js index 2078a5c..22bce79 100644 --- a/src/extension.js +++ b/src/extension.js @@ -46,7 +46,8 @@ const Soup = imports.gi.Soup; const Util = imports.misc.util; const UNITS = 'c'; // Units for temperature (case sensitive). f: Fahrenheit. c: Celsius -const YAHOO_ID = 'AUXX0010'; +const CITY_DISPLAYED = 'your city'; +const YAHOO_ID = 'your yahoo woeid'; const WEATHER_URL = 'http://weather.yahooapis.com/forecastjson?u=' + UNITS + '&p=' + YAHOO_ID; const FORECAST_URL = 'http://query.yahooapis.com/v1/public/yql?format=json&q=select%20item.forecast%20from%20weather.forecast%20where%20location%3D%22' + YAHOO_ID + '%22%20%20and%20u="' + UNITS + '"'; @@ -347,7 +348,7 @@ WeatherMenuButton.prototype = { // Refresh current weather this.load_json_async(WEATHER_URL, function(weather) { - let location = weather.get_object_member('location').get_string_member('city'); + let location = CITY_DISPLAYED; let comment = this.get_weather_condition(weather.get_object_member('condition').get_string_member('code'));//weather.get_object_member('condition').get_string_member('text'); let temperature = weather.get_object_member('condition').get_double_member('temperature'); let temperature_unit = '\u00b0' + weather.get_object_member('units').get_string_member('temperature');