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

@ -34,7 +34,7 @@ By id…
(aqi-report "@7397") (aqi-report "@7397")
#+END_SRC #+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 #+BEGIN_SRC emacs-lisp
(aqi-report "Taipei" 'brief) (aqi-report "Taipei" 'brief)

29
aqi.el
View file

@ -201,6 +201,24 @@
(format "%s (%s)" data city) (format "%s (%s)" data city)
(let-alist data (let-alist data
(format (format
(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). "Air Quality index in %s is %s as of %s (UTC%s).
\nDominant pollutant is %s \nDominant pollutant is %s
PM2.5 (fine particulate matter): %s PM2.5 (fine particulate matter): %s
@ -211,8 +229,9 @@ CO (Carbon Monoxide): %s
Humidity: %s Humidity: %s
Air pressure: %s Air pressure: %s
Wind: %s Wind: %s
\nFurther details can be found at %s \nFurther details can be found at [[%s][aqicn]].
\nData provided by %s and %s%s" \nData provided by %s and %s%s")
.city.name .city.name
.aqi .aqi
.time.s .time.s
@ -233,7 +252,8 @@ Wind: %s
;;;###autoload ;;;###autoload
(defun aqi-report (&optional place type) (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\"): ") (interactive "sName of city or monitoring station (RET for \"here\"): ")
(let* ((city (if (and (string< "" place) place) place "here")) (let* ((city (if (and (string< "" place) place) place "here"))
(aqi-output (get-buffer-create (format "*Air Quality - %s*" city)))) (aqi-output (get-buffer-create (format "*Air Quality - %s*" city))))
@ -246,7 +266,8 @@ Wind: %s
('nil (insert (aqi-report-full city))) ('nil (insert (aqi-report-full city)))
(other (warn "Unknown report type: '%s. Try using 'full or 'brief" other))) (other (warn "Unknown report type: '%s. Try using 'full or 'brief" other)))
(goto-char (point-max)) (goto-char (point-max))
(insert "")) (insert "")
(org-mode))
(display-buffer aqi-output)) (display-buffer aqi-output))
t) t)