From 25c80f8e3536225d3961ecff14ab8489892739a8 Mon Sep 17 00:00:00 2001 From: nik gaffney Date: Tue, 30 May 2023 13:42:19 +0200 Subject: [PATCH] =?UTF-8?q?Air=20Quality=20Index=20in=20Vi=C5=A1njan,=20Cr?= =?UTF-8?q?oatia=20is=2040=20and=20the=20dominant=20pollutant=20is=20o3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/melpazoid-aqi.yml | 30 ++++++++++++++++++++++++++++ README.org | 4 ++-- aqi.el | 31 ++++++++++++++++++++++++----- 3 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/melpazoid-aqi.yml diff --git a/.github/workflows/melpazoid-aqi.yml b/.github/workflows/melpazoid-aqi.yml new file mode 100644 index 0000000..6c401e8 --- /dev/null +++ b/.github/workflows/melpazoid-aqi.yml @@ -0,0 +1,30 @@ +# 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 diff --git a/README.org b/README.org index 4a8534f..3119d13 100644 --- a/README.org +++ b/README.org @@ -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) diff --git a/aqi.el b/aqi.el index e56dac7..6e54fc1 100644 --- a/aqi.el +++ b/aqi.el @@ -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)