;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\306\307\310\311\312\313%\210\314\315\316\317\312\307\320\321&\207" [require cl-lib url url-cache xml time-date custom-declare-group yandex-weather nil "Yandex Weather." :group comm custom-declare-variable yandex-weather-use-https t "Default protocol to use to access the Yandex Weather API." :type boolean] 8) #@17 URL of the API. (defconst yandex-weather-forecast-url "export.yandex.ru/weather-ng/forecasts/" (#$ . 476)) #@19 URL of the icons. (defconst yandex-weather-icon-url "yandex.st/weather/1.1.86/i/icons/22x22/" (#$ . 589)) #@21 Temperature symbol. (defconst yandex-weather-temperature-symbol "°C" (#$ . 701)) #@51 Check if URL is cached for more than EXPIRE-TIME. (defalias 'yandex-weather-cache-expired #[(url expire-time) "\203 \304\305 !!?\207\306 !\211\203 \307\310\n\311 !\"\312 \"\202!\313)\207" [url-standalone-mode url cache-time expire-time file-exists-p url-cache-create-filename url-is-cached time-less-p time-add seconds-to-time current-time t] 6 (#$ . 789)]) #@27 Fetch URL from the cache. (defalias 'yandex-weather-cache-fetch #[(url) "r\301\302!q\210\303\304!!\210p)\207" [url generate-new-buffer " *temp*" url-cache-extract url-cache-create-filename] 3 (#$ . 1158)]) #@265 Retrieve URL and return its data as string. If EXPIRE-TIME is set, the data will be fetched from the cache if their are not older than EXPIRE-TIME seconds. Otherwise, they will be fetched and then cached. Therefore, setting EXPIRE-TIME to 0 force a cache renewal. (defalias 'yandex-weather-retrieve-data-raw #[(url &optional expire-time) "\203 \305 \"\202\f\306\211\203\307 !\202\310 !\311\n\203)\203)\312 !\210 +\207" [expire-time url expired buffer data yandex-weather-cache-expired t url-retrieve-synchronously yandex-weather-cache-fetch nil url-store-in-cache] 4 (#$ . 1372)]) #@265 Retrieve URL and return its data as string. If EXPIRE-TIME is set, the data will be fetched from the cache if their are not older than EXPIRE-TIME seconds. Otherwise, they will be fetched and then cached. Therefore, setting EXPIRE-TIME to 0 force a cache renewal. (defalias 'yandex-weather-retrieve-data #[(url &optional expire-time) "r\303 \"q\210eb\210\304\305\306\307#\204\310\311!\210\312`d\313`d\307##\210\314\307!\210\315`d\"\316p!\210\n*\207" [url expire-time data yandex-weather-retrieve-data-raw search-forward "\n\n" nil t error "Data not found." decode-coding-region detect-coding-region set-buffer-multibyte xml-parse-region kill-buffer] 7 (#$ . 1974)]) (defalias 'yandex-weather-retrieve-icon #[(url &optional expire-time) "r\303 \"q\210eb\210\304\305\306\307#\204\310\311!\210\312\306!\210`d{\313p!\210\n*\207" [url expire-time data yandex-weather-retrieve-data-raw search-forward "\n\n" nil t error "Data not found." set-buffer-multibyte kill-buffer] 4]) (defalias 'yandex-weather-get-icon #[(icon-name &optional expire-time) "\302\303! \"\207" [icon-name expire-time yandex-weather-retrieve-icon yandex-weather-build-icon-url] 3]) #@151 Build URL to retrieve weather for LOCATION. LOCATION can be finded http://weather.yandex.ru/static/cities.xml . We need 'id' field in the 'city' tag. (defalias 'yandex-weather-build-forecast-url #[(location) "\303\205\304\305 \n\306\260\207" [yandex-weather-use-https yandex-weather-forecast-url location "http" "s" "://" ".xml"] 6 (#$ . 3137)]) #@41 Build URL to retrieve icon for weather. (defalias 'yandex-weather-build-icon-url #[(icon-num) "\303\205\304\305 \n\306\260\207" [yandex-weather-use-https yandex-weather-icon-url icon-num "http" "s" "://" ".png"] 6 (#$ . 3493)]) #@95 Get weather data for LOCATION. See `yandex-weather-retrieve-data' for the use of EXPIRE-TIME. (defalias 'yandex-weather-get-data #[(location &optional expire-time) "\302\303! \"\207" [location expire-time yandex-weather-retrieve-data yandex-weather-build-forecast-url] 3 (#$ . 3731)]) #@43 Return all weather information from DATA. (defalias 'yandex-weather-data->all-info #[(data) "\301\236A\207" [data forecast] 2 (#$ . 4023)]) #@43 Return the city where the DATA come from. (defalias 'yandex-weather-data->city #[(data) "\301\302!@\236A\207" [data city yandex-weather-data->all-info] 3 (#$ . 4170)]) #@46 Return forecasts for all days from the DATA. (defalias 'yandex-weather-data->forecasts #[(data) "\301\302!\303\"\207" [data xml-get-children yandex-weather-data->all-info day] 3 (#$ . 4345)]) #@63 Return the forecast of the weather for the DATA for the DATE. (defalias 'yandex-weather-data->forecast-by-date #[(data date) "\305\306\3078@A@$\310 !\311\312\313 \"\210\n+\207" [date data retvalue forecasts forecast-date format "%.4d-%.2d-%.2d" 2 yandex-weather-data->forecasts nil mapc #[(x) "\303\211A@\262\236A \232\205\211\207" [x forecast-date retvalue date] 3]] 5 (#$ . 4544)]) #@44 Return required DAY-PART for the FORECAST. (defalias 'yandex-weather-forecast->day-part #[(forecast day-part) "\302\303\304\305 \306\"\"\210)\207" [retvalue forecast nil mapc #[(x) "\303\211A@\262\236A \232\205\211\207" [x day-part retvalue type] 3] xml-get-children day_part] 5 (#$ . 4946)]) #@67 Return the average temperature for the FORECAST and day DAY-PART. (defalias 'yandex-weather-forecast->avg-temperature #[(forecast day-part) "\302\303\211\304 \"\305\"@\306\"@8\207" [forecast day-part 2 xml-get-children yandex-weather-forecast->day-part temperature-data avg] 6 (#$ . 5253)]) #@56 Return the average night temperature for the FORECAST. (defalias 'yandex-weather-forecast->avg-night-temperature #[(forecast) "\301\302\"\207" [forecast yandex-weather-forecast->avg-temperature "night"] 3 (#$ . 5551)]) #@54 Return the average day temperature for the FORECAST. (defalias 'yandex-weather-forecast->avg-day-temperature #[(forecast) "\301\302\"\207" [forecast yandex-weather-forecast->avg-temperature "day"] 3 (#$ . 5777)]) #@49 Return the value of CHARACTERISTIC of FORECAST. (defalias 'yandex-weather-forecast->get-characteristic #[(forecast characteristic) "\302\303\304\305\" \"@8\207" [forecast characteristic 2 xml-get-children yandex-weather-forecast->day-part "day"] 5 (#$ . 5997)]) #@40 Return the condition for the FORECAST. (defalias 'yandex-weather-forecast->condition #[(forecast) "\301\302\"\207" [forecast yandex-weather-forecast->get-characteristic weather_type] 3 (#$ . 6266)]) #@39 Return the pressure for the FORECAST. (defalias 'yandex-weather-forecast->pressure #[(forecast) "\301\302\"\207" [forecast yandex-weather-forecast->get-characteristic pressure] 3 (#$ . 6472)]) #@39 Return the humidity for the FORECAST. (defalias 'yandex-weather-forecast->humidity #[(forecast) "\301\302\"\207" [forecast yandex-weather-forecast->get-characteristic humidity] 3 (#$ . 6672)]) #@44 Return the speed of wind for the FORECAST. (defalias 'yandex-weather-forecast->wind-speed #[(forecast) "\301\302\"\207" [forecast yandex-weather-forecast->get-characteristic wind_speed] 3 (#$ . 6872)]) #@45 Return the wind direction for the FORECAST. (defalias 'yandex-weather-forecast->wind-direction #[(forecast) "\301\302\"\207" [forecast yandex-weather-forecast->get-characteristic wind_direction] 3 (#$ . 7081)]) #@47 Return the name of the icon for the FORECAST. (defalias 'yandex-weather-forecast->icon #[(forecast) "\301\302\"\207" [forecast yandex-weather-forecast->get-characteristic image-v2] 3 (#$ . 7299)]) (provide 'yandex-weather)