diff --git a/glance-system/glance-kisfenyo.yaml b/glance-system/glance-kisfenyo.yaml index 926d6fe..69c9cc7 100644 --- a/glance-system/glance-kisfenyo.yaml +++ b/glance-system/glance-kisfenyo.yaml @@ -365,108 +365,139 @@ data: - type: split-column max-columns: 3 widgets: - # Weather Widget - Időkép Scraper + # Weather Widget (Időkép) - type: custom-api - url: https://www.idokep.hu/idojaras/Budapest + title: Időkép – Budapest VIII. + url: http://idokep-proxy.glance-system.svc.cluster.local:8000/api/idokep?place=Budapest%20VIII.%20ker cache: 15m - skip-json-validation: true - style: - grid-column: span 4 - grid-row: span 3 template: | - {{/* 1. Extract Body and Current Data */}} - {{ $body := .Body }} - {{ $temp := findSubmatch "current-temperature\">([^˚<]+)" $body | trimSpace }} - {{ $cond := findSubmatch "current-weather\">([^<]+)" $body | trimSpace }} - {{ $icon := findSubmatch "forecast-bigicon\"[^>]+src=\"([^\"]+)\"" $body }} - {{ $sunrise := findSubmatch "Napkelte ([0-9:]+)" $body }} - {{ $sunset := findSubmatch "Napnyugta ([0-9:]+)" $body }} - - {{/* 2. Split HTML by the Forecast Column class to get daily blocks */}} - {{ $parts := split $body "
" }} - -
- {{/* Current Conditions Section */}} -
-
-

Budapest

-
{{ $temp }}°C
-
{{ $cond }}
+ {{ if .JSON.Exists "error" }} +
+ {{ .JSON.String "error" }}
+ Place: {{ .JSON.String "place" }} +
+ {{ else }} + {{ $c := .JSON.JSON "current" }} + {{ $hourly := .JSON.Array "hourly" }} + {{ $daily := .JSON.Array "daily" }} + {{ $src := .JSON.JSON "source" }} + +
+
+
+ {{ if $c.Exists "icon_url" }}{{ end }} +
+
{{ $c.Float "temp_c" | toInt }}°C
+
{{ $c.String "condition_hu" }}
+
+
+
{{ .JSON.String "place" }}
- weather -
- {{/* Sunrise/Sunset info */}} -
- ↑ {{ $sunrise }} - ↓ {{ $sunset }} -
- - {{/* 5-Day Forecast List */}} -
- {{ range $i := list 1 2 3 4 5 }} - {{ $block := index $parts $i }} - {{ if $block }} - {{ $d_num := findSubmatch "dfDayNum\">([0-9]+)" $block }} - {{ $d_name := findSubmatch "dfDay\">([^<]+)" $block }} - {{ $d_icon := findSubmatch "src=\"([^\"]+)\"" $block }} - {{ $d_max := findSubmatch "class=\"max\">([^<]+)" $block }} - {{ $d_min := findSubmatch "class=\"min\">([^<]+)" $block }} - -
- {{ $d_num }} {{ $d_name }} - - {{ $d_min }}° -
-
-
- {{ $d_max }}° +
+ {{ range $hourly }} +
+
{{ .String "hour" }}
+ {{ if .Exists "icon_url" }}{{ end }} +
{{ .Float "temp_c" | toInt }}°
+ {{ if .Exists "precip_pct" }} +
{{ .Float "precip_pct" | toInt }}%
+ {{ else }} +
 
+ {{ end }}
{{ end }} - {{ end }} -
+
- {{/* Footer Link */}} -
- idokep.hu elorejelzes +
+ {{ range $daily }} +
+
{{ .String "dow" }}
+ {{ if .Exists "icon_url" }}{{ end }} +
+ {{ if and (.Exists "bar_left_pct") (.Exists "bar_width_pct") }} + + {{ else }} + + {{ end }} +
+
+
{{ .Float "tmin_c" | toInt }}°
+
{{ .Float "tmax_c" | toInt }}°
+ {{ if .Exists "prec_mm" }}
{{ .Float "prec_mm" }}mm
{{ end }} +
+
+ {{ end }} +
+ +
-
+ {{ end }} # Calendar Widget - type: calendar