Updates failing

208 views
Skip to first unread message

aslamK

unread,
Apr 20, 2016, 7:39:32 PM4/20/16
to Cinnamon Weather
Linux Mint 17.3
cinnamon-weather 1.12.4

Looking Glass log has the following repeating entry:

error t=2016-04-20T19:25:13Z weather@mockturtl#: TypeError: json.get_object_member(...).get_object_member(...).get_object_member(...) is null

Brian J. Murrell

unread,
Apr 21, 2016, 11:40:51 AM4/21/16
to cinnamon...@googlegroups.com
signature.asc

aslamK

unread,
May 1, 2016, 12:28:10 AM5/1/16
to Cinnamon Weather
Thanks.

It's actually issue #134: https://github.com/mockturtl/cinnamon-weather/issues/134

I did the following to get the applet working again:
  1. Got my WOEID using http://zourbuth.com/tools/woeid/ and updated it in the applet config -- Yahoo! has changed its API and it now uses different WOEIDs.
  2. Applied the changes to applet.js posted in this comment: https://github.com/mockturtl/cinnamon-weather/issues/134#issuecomment-210997641
  3. Restarted Cinnamon.

Yann Langlais

unread,
May 2, 2016, 10:55:16 AM5/2/16
to Cinnamon Weather

Apparently yahoo changed or his api.
Here are some modifications to use the "new" api ( https://query.yahooapis.com/v1/public/yql?format=json&env=store://datatables.org/alltableswithkeys&q=select%20*%20from%20weather.forecast%20where%20woeid=%22FRXX0280%22 )
I added 2 fixes (incorrect pressure units in celcius mode, incorrect wind chill temp unit).

diff applet.js.old applet.js
61,65c61,63
< const QUERY_PARAMS = '?format=json&q=select '
< const QUERY_TABLE = 'feednormalizer where url="http://xml.weather.yahoo.com/forecastrss/'
< const QUERY_VIEW = '*'
< const QUERY_URL = 'http://query.yahooapis.com/v1/public/yql' + QUERY_PARAMS + QUERY_VIEW + ' from ' + QUERY_TABLE
<
---
> const QUERY_URL = 'https://query.yahooapis.com/v1/public/yql'
> const QUERY_PARAMS = 'format=json&env=store://datatables.org/alltableswithkeys'
> const QUERY = 'select * from weather.forecast where woeid='
389c387
<         let weather = json.get_object_member('query').get_object_member('results').get_object_member('rss').get_object_member('channel')
---
>         let weather = json.get_object_member('query').get_object_member('results').get_object_member('channel')
405,406c403
<         //let pressure_unit = weather.get_object_member('units').get_string_member('pressure')
<         //log('pressure: ' + pressure + ' ' + pressure_unit)
---
>         let pressure_unit = weather.get_object_member('units').get_string_member('pressure')
472a470,473
>         if (this._temperatureUnit == WeatherUnits.CELSIUS) {
>             wind_chill = Math.round((wind_chill - 32) * 5 / 9);
>          }
>
476a478,483
>
>         // Check if yahoo returned mb or inHG while temperature in celcius:
>         if (this._temperatureUnit != WeatherUnits.FAHRENHEIT && pressure > 20) {
>             pressure = pressure / WEATHER_CONV_MBAR_IN_INHG
>         }
>
801,802c808,813
<     //let output = QUERY_URL + ' where location="' + this._woeid + '" and u="' + this.unitToUrl() + '"'
<     let output = QUERY_URL + this._woeid + '_' + this.unitToUrl() + '.xml"'
---
>     unit = ""
>     if (this._temperatureUnit != WeatherUnits.FAHRENHEIT) {
>         unit = " and u = 'c'"
>     }
>     let query = "select * from weather.forecast where  woeid ='" + this._woeid + "'" + unit
>     let output = QUERY_URL + '?' + QUERY_PARAMS + "&q=" + query


However, I can't figure out why translation doesn't work while my locale is supported.

Regards.
Reply all
Reply to author
Forward
0 new messages