Air Quality Index in Višnjan, Croatia is 40 and the dominant pollutant is o3

This commit is contained in:
nik gaffney 2023-05-30 13:42:19 +02:00
parent c107a2e21c
commit 25c80f8e35
Signed by: nik
GPG key ID: 989F5E6EDB478160
3 changed files with 58 additions and 7 deletions

30
.github/workflows/melpazoid-aqi.yml vendored Normal file
View file

@ -0,0 +1,30 @@
# melpazoid <https://github.com/riscy/melpazoid> build checks.
# for aqi package
name: melpazoid-aqi
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install
run: |
python -m pip install --upgrade pip
sudo apt-get install emacs && emacs --version
git clone https://github.com/riscy/melpazoid.git ~/melpazoid
pip install ~/melpazoid
- name: Run
env:
LOCAL_REPO: ${{ github.workspace }}
# RECIPE is your recipe as written for MELPA:
RECIPE: (aqi :repo "zzkt/aqi" :fetcher github)
# set this to false (or remove it) if the package isn't on MELPA:
EXIST_OK: true
run: echo $GITHUB_REF && make -C ~/melpazoid

View file

@ -1,6 +1,6 @@
* Air Quality Index (AQI)
[[https://melpa.org/#/aqi][file:https://melpa.org/packages/aqi-badge.svg]]
[[https://melpa.org/#/aqi][file:https://melpa.org/packages/aqi-badge.svg]]
The =aqi= package provides an interface to the World Air Quality Index.
@ -34,7 +34,7 @@ By id…
(aqi-report "@7397")
#+END_SRC
A detailed report is displayed by default and a single line summary can be provided by using the keyword ='brief=
A detailed report is displayed by default and a single line summary can be provided by using the keyword =brief=
#+BEGIN_SRC emacs-lisp
(aqi-report "Taipei" 'brief)

31
aqi.el
View file

@ -201,7 +201,25 @@
(format "%s (%s)" data city)
(let-alist data
(format
"Air Quality index in %s is %s as of %s (UTC%s).
(if (fboundp 'org-mode)
;; org mode formatted report
"* Air Quality index in %s is %s
\nMost recent report at %s (UTC%s).\n
| Dominant pollutant | %s |
| PM2.5 (fine particulate matter) | %s |
| PM10 (respirable particulate matter) | %s |
| NO2 (Nitrogen Dioxide) | %s |
| CO (Carbon Monoxide) | %s |
| | |
| Temperature (Celsius) | %s |
| Humidity | %s |
| Air pressure | %s |
| Wind | %s |
\nFurther details can be found at [[%s][aqicn]].
\nData provided by %s and %s%s"
;; text mode
"Air Quality index in %s is %s as of %s (UTC%s).
\nDominant pollutant is %s
PM2.5 (fine particulate matter): %s
PM10 (respirable particulate matter): %s
@ -211,8 +229,9 @@ CO (Carbon Monoxide): %s
Humidity: %s
Air pressure: %s
Wind: %s
\nFurther details can be found at %s
\nData provided by %s and %s%s"
\nFurther details can be found at [[%s][aqicn]].
\nData provided by %s and %s%s")
.city.name
.aqi
.time.s
@ -233,7 +252,8 @@ Wind: %s
;;;###autoload
(defun aqi-report (&optional place type)
"General air quality info from PLACE (or 'here' if no args are given) report TYPE can be 'brief' or 'full'."
"General air quality info from PLACE (or `here' if no PLACE is given).
Report TYPE can be `brief' or `full'."
(interactive "sName of city or monitoring station (RET for \"here\"): ")
(let* ((city (if (and (string< "" place) place) place "here"))
(aqi-output (get-buffer-create (format "*Air Quality - %s*" city))))
@ -246,7 +266,8 @@ Wind: %s
('nil (insert (aqi-report-full city)))
(other (warn "Unknown report type: '%s. Try using 'full or 'brief" other)))
(goto-char (point-max))
(insert ""))
(insert "")
(org-mode))
(display-buffer aqi-output))
t)