Uusi Conky sääscripta (ilmatieteenlaitos.fi)

muutoksesi ovat kunnossa.

asensin lubuntua 14.04 LTS virtuaalikoneeseen, ja minulla ei näy yhtään kuvaketta!
“ln” kommento taittaa toimia jotenkin eri tavalla. tutkin asiaa.

olen muuten huomannut että scripta ei anna mitään varoitusta jos libxml2-utils ei ole asennettu. se vain ei tee mitään ja käyttää jotain vanhaa ennustetta.
varmista siis että kaikki riippuvuudet on asennettu.

Lisään tähän toimivan ja toimimattoman kuvat.
Toimiva…


Toimimaton…

Tässä login diffiä, mutta eipä siinä pahemmin eroja ole ???

$ diff -rup Toimiva-itl.sh.logfile Virheellinen-itl.sh.logfile 
--- Toimiva-itl.sh.logfile	2015-06-16 20:46:46.451937362 +0300
+++ Virheellinen-itl.sh.logfile	2015-06-16 20:46:29.083687690 +0300
@@ -3,20 +3,20 @@ default.cfg is a file. sourced.
 :: URL is http://ilmatieteenlaitos.fi/saa/lahti, Language is fi
 :: Will attempt to fetch weather data for http://ilmatieteenlaitos.fi/saa/lahti ...
 
---2015-06-16 20:35:31--  http://ilmatieteenlaitos.fi/saa/lahti
+--2015-06-16 20:26:01--  http://ilmatieteenlaitos.fi/saa/lahti
 Selvitetään osoitetta ilmatieteenlaitos.fi (ilmatieteenlaitos.fi)... 193.166.221.20
 Yhdistetään palvelimeen ilmatieteenlaitos.fi (ilmatieteenlaitos.fi)|193.166.221.20|:80... yhdistetty.
 HTTP-pyyntö lähetetty, odotetaan vastausta... 200 OK
-Pituus: 136900 (134K) [text/html]
+Pituus: 135384 (132K) [text/html]
 Tallennetaan kohteeseen ”forecast/raw”
 
-     0K .......... .......... .......... .......... .......... 37% 2,35M 0s
-    50K .......... .......... .......... .......... .......... 74% 3,13M 0s
-   100K .......... .......... .......... ...                  100% 6,18M=0,04s
+     0K .......... .......... .......... .......... .......... 37% 1,23M 0s
+    50K .......... .......... .......... .......... .......... 75% 1,68M 0s
+   100K .......... .......... .......... ..                   100% 2,74M=0,08s
 
-2015-06-16 20:35:32 (3,13 MB/s) - ”forecast/raw” tallennettu [136900/136900]
+2015-06-16 20:26:02 (1,61 MB/s) - ”forecast/raw” tallennettu [135384/135384]
 
-:: When was the data fetched: 20:35
+:: When was the data fetched: 20:26
 :: Extracting timerange short to meteogram
 :: Filling arrays and creating symlinks
 :: == [0] ==

Kokeilin seuraavaa, ja tämä saattaa toimia. Eli jostain syystä Lubuntu ei poista vanhoja symbolisia linkkeja, kuten arvelitkin…

        if [[ $ConkyVar = 1 ]]
        then
            ___msg___ "Conky-specific things"

            [ -d "$OutDir/$timerange" ] || $MKDIR "$OutDir/$timerange"

            ___msg___ "Creating symlinks for forecast and precipitation-bar images"
            ######################################################################
            #added by peran
            rm "$OutDir/$timerange/.fc${count}.png"
            rm "$OutDir/$timerange/.pb${count}.png"
            #added by peran

            ln -r -f -s "$FcImgDir/${weather_img[count]}.png" "$OutDir/$timerange/.fc${count}.png"
            ln -r -f -s "$PrecBarDir/${prec_bar[count]}.png" "$OutDir/$timerange/.pb${count}.png"
            
            temp_plusminus[count]="$(echo ${temp_plusminus[count]} | sed "s/positive/$col_pos/g ; s/negative/$col_neg/g")"
            ___msg___ "replace positive/negative with conky colors in temp_plusminus, is now: ${temp_plusminus[count]}"
            
            wind_txt[count]="$(echo ${wind_txt[count]} | sed "s/tuulta// ; s/.ind // ; s/lig// ; s/north/N/ ; s/east/E/ ; s/south/S/ ; s/west/W/")"
            ___msg___ "shorten wind_txt, is now: ${wind_txt[count]}"

juu, minä sain just saman selväks.
omituista, mun archlinuxilla tuo “ln -f” toimii moitteettomasti.
versioissa on hieman eroa. archlinuxilla on: ln (GNU coreutils) 8.23
ja lubuntu 14.04:llä on: ln (GNU coreutils) 8.21

vähän hienompi ratkaisu on jos poistat lisäystäsi, sitten korvaat tämän:

ln -r -f -s "$FcImgDir/${weather_img[count]}.png" "$OutDir/$timerange/.fc${count}.png"
ln -r -f -s "$PrecBarDir/${prec_bar[count]}.png" "$OutDir/$timerange/.pb${count}.png"

tällä:

ln -vrs "$FcImgDir/${weather_img[count]}.png" "$OutDir/$timerange/.fc${count}"
ln -vrs "$PrecBarDir/${prec_bar[count]}.png" "$OutDir/$timerange/.pb${count}"
mv -vf "$OutDir/$timerange/.fc${count}" "$OutDir/$timerange/.fc${count}.png"
mv -vf "$OutDir/$timerange/.pb${count}" "$OutDir/$timerange/.pb${count}.png"

ps: “-v” optiota ei varsin tarvita, mutta se auttaa löytämään ongelmia. itl.sh scripta luo debug-tiedoston joka suorituksella.

(kirjoittajan poistama viesti)

2 tykkäystä

paljon uudistuksia, korjasin pieniä virheitä (mikä on “bug” suomeksi?).
yritän pikkuhiljaa parantaa config-tiedostojen logiikkaa ja dokumentoida sitä.

Ohjelmointivirhe, yleensä puhekielessä sanotaan vain bugi.

Ammattipiireissä kyseinen “Bug” sana käännetään sanaksi “ominaisuus”.
:stuck_out_tongue_winking_eye:

1 tykkäys

ok, kiitos.
kai “bugi” kelpaa.

Huom!
Scripta tarvitsee conky 1.9 versioita (tai ehkä pienempääkin).
Jotkut jakelut käyttävät conky 1.10 oletusversiona, joka käyttää uutta syntaksia (lua). Tämä scripta ei toimi 1.10 versioiden kanssa.

(kirjoittajan poistama viesti)

huomasin että tämä EI pidä paikkansa.
scripta toimii sekä 1.9.x että 1.10.x conky-versioilla!!!

Tähän meni eilen paljon siivoustyötä.
Kaikki on vähän isompaa, ja hyödyttömästä “Katso kaikki varoitukset” viestistä luovuin.
Varoituksia ei siis näy conkyssa ollenkaan enää, koska niiden logiikka on muuttunut täysin.

Suomenkielisesta README:stä luovuin kokonaan. Sori.

Muistaakseni käynnistyskommento on vielä sama, mutta parempi tarkistaa.

Uusi oletusfontti on “DejaVu Sans” koska se on mukana ainakin kaikissa debian-kaltaisissa jakeluissa. Hyvä valinta?
Valitettavasti lopputulos silti ei ole ihan samannäköinen erilaisissa jakeluissa; testaan vielä.

Kohta tulee lisää parannuksia!
– uudet kuvakkeet
– paikalliset säähavainnot

uusia kuvakkeita nyt on!
tai oikeastaan ne pitää ladata itse ilmatieteen laitoksen sivuilta, koska en tiedä saako ne jakaa eteenpäin.
lisäsin geticons.sh scriptan joka kysyy mitä haluat & lataa kansioihin niin että ne voi heti käyttää.
vaihtoehtoja on 3:
Värikäs SVG
Suuret siniset mobiilisivulta
Pienet valkoiset mobiilisivulta

En tiedä saanko paikalliset säähavainnot ikinä takaisin; ne on nykyään piilotettu javascriptan takana. Tutkin asiaa eilen, ja mahdolliset ratkaisut ovat joko hauraita tai sitten vaativat raskaat riippuvuudet.

Onkohan chromesta apua ?

Sillä saa tulostettua DOM-puun tiedostoksi.

google-chrome --headless --disable-gpu --dump-dom http://ilmatieteenlaitos.fi/paikallissaa >saa.html

En jaksanut tutkia enempää itl:n sivuja, mutta siitä saattaa olla apua sinulle.

ja chromium kanssa, ja myös vivaldi!

kiitos, tästä on tosiaan apua; raskas riippuvuus se on, mutta monilla on varmaan joku näistä asennettu.

tutkin nyt myös phantomjs jne.

nettisivu käyttää uudet kuvakkeet, ja ne un numeroitu eri tavalla, jonka takia scripta ei näytä kuvakkeita enää.

kohta tulee kunnon päivistys, mutta tällä saa scriptan taas toimimaan:

#!/bin/bash

path=( "img/fc-img-svg" "img/fc-img-orig" "img/fc-img-alpha80" "img/fc-img-less-alpha80" "img/fc-img-gray" )
sep="________________"

cat <<EOF

Download icons straight from the Finnish Meteorological Insitute's website.
===========================================================================
Apply some conversions.
=======================

Colorful vector icons as seen here: http://ilmatieteenlaitos.fi/saa/helsinki

The SVG icons (unusable by conky) will be downloaded first, then
converted to 4 different 60px PNG icon sets:
    - original
    - original, 80% opacity
    - 90% brightness, 90% saturation, 80% opacity
    - 70% brightness, 0% saturation, 100% opacity

It is best if you call this script from the base directory of the
conky-itl-weather repository. Make sure you have write permissions for the 
present working directory.

Requirements: wget for downloading, imagemagick (convert) for all conversions.

EOF

read -p "Press <Enter> to continue... "

! which wget >/dev/null 2>&1 && echo "Could not find wget in PATH. No downloading. :(" && exit 1

i=0
mkdir -vp "${path[i]}" || exit 1
printf "\nThe vector icon set is now downloaded to %s\n" "${path[i]}"

for ((c=0 ; c<200 ; c++)); do
	wget -O "${path[i]}/$c.svg" https://cdn.fmi.fi/symbol-images/smartsymbol/p/$c.svg >/dev/null 2>&1
	printf '.'
done
printf "\n"
# delete all the empty files wget produced.
find "${path[i]}" -maxdepth 1 -empty -type f -delete

! which convert >/dev/null 2>&1 && echo "Could not find convert (imagemagick) in PATH. No conversion. :(" && exit 1

for (( i=1 ; i<${#path[@]} ; i++ )); do
	printf "\nCreating directory ${path[i]}\n$sep\n"
	mkdir -p "${path[i]}"

	case $i in
	1)	command="convert -background none -resize 60"
	;;
	2)	command="convert -background none -channel A -evaluate divide 1.25 +channel -resize 60"
	;;
	3)	command="convert -background none -channel A -evaluate divide 1.25 +channel -define modulate:colorspace=HSB -modulate 100,90,90 -resize 60"
	;;
	4)	command="convert -background none -grayscale rec601luma -define modulate:colorspace=HSB -modulate 100,100,70 -resize 60"
	;;
	esac
	printf "\nUsing command \n$command\nConverting ${path[0]}/*.svg to ${path[i]}/*.png\n$sep\n"; 
	for file in "${path[0]}"/*.svg; do
		$command "$file" "${file%.*}.png"
	done
	mv "${path[0]}"/*.png "${path[i]}/"
done

printf "\nSuccess! Now you can adjust your config file to include one of:\n"
for (( i=1 ; i<${#path[@]} ; i++ )); do
	echo "FcImgDir=\"${path[i]}\""
done

Kaikki on nyt päivitetty kunnolla, testattu debianilla (stretch) ja Xubuntulla (16.04.3) mun oman archlinux koneen lisäksi.
Olen muuttanut aika paljon, joten kannattaa katsoa vähän tarkemmin jos jotain ei toimi ihan automaattisesti.
Huom: kuvakkeita on nyt pakko ladata itse ilmatieteen laitoksen verkkosivuilta! mutta geticons.sh-scriptan avulla se onnistuu helposti.
kuvakaappaus
https://github.com/ohnonot/conky-itl-weather/

Tästä lähtien projektini löytyvät täältä:
https://notabug.org/ohnonot -
tai täältä:
https://framagit.org/ohnonot (molemmat aina samalla tasolla).

goodbye github!

Hei, ilmeisesti päädyttiin GitHubin käyttäjäksi ja sittemmin GitLabin käyttöliittymää muistuttavaan , mutta Git-keskusteluun heittäisin vielä jotain. Gitea toimii vaikka Raspberry Pi:llä ja siten olisi omassa hallinnassa.

Hieno projekti!

Gitea
https://gitea.io/en-us/
https://docs.gitea.io/en-us/comparison/

Hei, tämä projekti on vielä elossa.
Pahoittelen etten jaksa dokumentoida kaiken kahdella kielellä - tässä englanninkielinen README:


The scripts in this repository will

  • download forecast information for a given location
  • format it according to configuration settings
  • display it in a conky in a separate window (to be executed by a hotkey or menu icon)

Installation

Clone the repository or download the zip to a folder of your choice. Keep in mind that all files need to stay together.

From framagit.org | Download zip file

From notabug.org | Download zip file

Dependencies

For the main script get_weather:

  • jshon, curl, sed (for conky formatted output)

  • bash

  • the coreutils package

  • a conky version with lua support - on Arch Linux this most likely means conky-lua-nv or conky-cairo.
    On other distros, if you’re unsure, look out for a package named conky-all. The script itself doesn’t require conky; its plain text output can be used elsewhere.

  • Some helper scripts have their own dependencies, but they will tell you if something’s missing.

  • yad for location-select (available in most distro repositories)

  • Recommended: the “Roboto Condensed” font, available through most ditributions’ package management.

Quickstart

$ cd /path/to/conky-fmi-weather/
$ ./location-select

Allows you to choose your location & immediately display the forecast window.

If one location is enough, you can start the conky immediately after choosing a location for the first time.

Usage & Configuration

The location and additional stuff can be configured in files/get_weather.d/conf. Please see the output of

$ ./get_weather -h

This script gets weather data from widget.weatherproof.fi/android/androidwidget.php, downloads icons from cdn.fmi.fi/symbol-images/smartsymbol/v31/p, and wind gust data from opendata.fmi.fi.

Most data and files are cached in files/get_weather.d and only re-downloaded when necessary.

Other scripts in this repository

  • The get_location_id bash script will get your location’s id from geonames.org (location-select uses it).
  • The get_weather_opendata bash script is an alternative implementation that uses only data from opendata.fmi.fi.
  • The wfs_describeStoredQueries bash script allows you to get more information about what sort of data you can
    get from opendata.fmi.fi.

All scripts have -h switches for help.

If you experience problems

If you don’t know conky, check this out first.

  • It might be a network problem.
  • make sure the shell scripts are executable:
    chmod +x ./get_* (this normally shouldn’t be an issue).
  • Have a look at the lua templates in files (used by ./get_weather to create conky-readable output).
  • for personal changes to the templates copy them to e.g. *.my.lua first, and remember to refer to them as such when calling the script, e.g.: ./get_weather -f my.lua
  • Take a look inside files/get_weather.d; all files therein can be deleted if they’re corrupt.
  • This is old info now: I have not been able to test on a conservative distro. There were some changes recently to how conky/lua deals with SVG files, and I had to fix things. I don’t know if these fixes are backwards compatible. You might need at least conky version 1.13.
  • Conky is damn buggy, at least on Arch Linux, and has been for a long time :angry:

If you found a bug please open an issue in one of the git repos.

This is ugly!

But it’s more precise than most “weather widgets”.

The reason I use this is because IMHO a locally retrieved weather forecast is always superior to one from a large international
website somewhere halfway around the globe, and because the Finnish Metereological Institute is not trying to sell me anything.

I am trying as far as possible to mirror the website’s way of displaying information (except for making it vertical).
It might look unwieldy, but it has more granularity and objectivity than most weather widgets out there.


Happy customizing and don’t forget to look out the window sometimes!