Gnome 时钟/日历小程序如何获取天气、日落和日出时间信息?

Gnome 时钟/日历小程序如何获取天气、日落和日出时间信息?

这个 Gnome 小程序如何以及在哪里获取天气信息?日出和日落时间也是同样的问题。

我想它会查询一个 Web API,但我可以使用哪一个 API?

侏儒天气小程序

(抱歉,屏幕截图是法语)

答案1

gnome-weather用途libgweather下面依次使用几个GWeatherProviders(定义在gweather-weather.h) 获取您特定地理位置的天气信息:

  * GWeatherProvider:
....
  * @GWEATHER_PROVIDER_METAR: METAR office, providing current conditions worldwide
  * @GWEATHER_PROVIDER_IWIN: US weather office, providing 7 days of forecast
  * @GWEATHER_PROVIDER_YAHOO: Yahoo Weather Service, removed in 3.27.1
  * @GWEATHER_PROVIDER_YR_NO: Yr.no service, worldwide but requires attribution
  * @GWEATHER_PROVIDER_OWM: OpenWeatherMap, worldwide and possibly more reliable, but requires attribution and is limited in the number of queries
....

你可以查看源代码,看看他们是如何做到的: weather-metar.c, weather-iwin.c, weather-yrno.c, weather-owm.c。也可以看看weather.c

日出和日落时间的计算方式为weather-sun.c

相关内容