diff --git a/glance-system/glance-kisfenyo.yaml b/glance-system/glance-kisfenyo.yaml index da0b57c..c22cc51 100644 --- a/glance-system/glance-kisfenyo.yaml +++ b/glance-system/glance-kisfenyo.yaml @@ -365,69 +365,90 @@ data: - type: split-column max-columns: 3 widgets: - # Weather Widget + # Weather Widget - Időkép Scraper - type: custom-api - url: https://www.idokep.hu/idojaras/Budapest - cache: 15m - style: - grid-column: span 4 - grid-row: span 3 - template: | - {{/* Extract Current Weather Data */}} - {{ $body := .Body }} - {{ $temp := findSubmatch `(?s)current-temperature">([^˚<]+)` $body }} - {{ $condition := findSubmatch `(?s)current-weather">([^<]+)` $body }} - {{ $icon := findSubmatch `(?s)forecast-bigicon"[^>]+src="([^"]+)"` $body }} - {{ $sunrise := findSubmatch `Napkelte ([0-9:]+)` $body }} - {{ $sunset := findSubmatch `Napnyugta ([0-9:]+)` $body }} - -
- {{/* Header: Location and Current Time */}} -
-
-

Budapest

-

{{ now | formatTime "Monday, Jan 02" }}

-
-
-
- ↑ {{ $sunrise }} - ↓ {{ $sunset }} -
-
-
+ url: https://www.idokep.hu/idojaras/Budapest + cache: 15m + style: + grid-column: span 4 + grid-row: span 3 + template: | + {{/* 1. Extract Current Data */}} + {{ $body := .Body }} + {{ $temp := findSubmatch `(?s)current-temperature">([^˚<]+)` $body | trimSpace }} + {{ $cond := findSubmatch `(?s)current-weather">([^<]+)
` $body | trimSpace }} + {{ $icon := findSubmatch `(?s)forecast-bigicon"[^>]+src="([^"]+)"` $body }} + {{ $sunrise := findSubmatch `Napkelte ([0-9:]+)` $body }} + {{ $sunset := findSubmatch `Napnyugta ([0-9:]+)` $body }} - {{/* Main Current Weather Display */}} -
-
- weather icon -
-
{{ $temp }}°C
-
{{ $condition }}
-
-
-
+ {{/* 2. Extract Daily Forecast (Regex patterns for specific day indices) */}} + {{/* Day 1 */}} + {{ $d1_pat := `(?s)dailyForecastCol.*?dfDayNum">([0-9]+).*?dfDay">([^<]+).*?src="([^"]+)".*?max[^>]+>([^<]+).*?min[^>]+>([^<]+)` }} + {{ $d1_num := findSubmatch $d1_pat $body }} + {{ $d1_day := index (findSubmatch $d1_pat $body) 1 }} + {{ $d1_icon := index (findSubmatch $d1_pat $body) 2 }} + {{ $d1_max := index (findSubmatch $d1_pat $body) 3 }} + {{ $d1_min := index (findSubmatch $d1_pat $body) 4 }} - {{/* Daily Forecast Section (Next 5 Days) */}} -
- {{/* Helper to extract a specific day's data using regex index-based groups is limited in Go templates, - so we extract the forecast block and manually grab the first few days. */}} - - {{ range $i := (list 1 2 3 4 5) }} - {{/* This logic identifies the columns in the daily forecast grid */}} - {{ $dayPattern := printf `(?s)dailyForecastCol.*?dfDayNum">([0-9]+).*?dfDay">([^<]+).*?src="([^"]+)".*?max[^>]+>([^<]+).*?min[^>]+>([^<]+)` }} - {{/* Note: Standard Glance regex findSubmatch returns the first match. To get multiple days, - we'd ideally need a loop. Since Glance regex is for single matches, - we'll use the current logic to display the next primary data points. */}} - {{ end }} + {{/* Day 2 (skipping 1 column) */}} + {{ $d2_pat := `(?s)dailyForecastCol.*?dailyForecastCol.*?dfDayNum">([0-9]+).*?dfDay">([^<]+).*?src="([^"]+)".*?max[^>]+>([^<]+).*?min[^>]+>([^<]+)` }} + {{ $d2_day := index (findSubmatch $d2_pat $body) 1 }} + {{ $d2_icon := index (findSubmatch $d2_pat $body) 2 }} + {{ $d2_max := index (findSubmatch $d2_pat $body) 3 }} + {{ $d2_min := index (findSubmatch $d2_pat $body) 4 }} - {{/* Fallback to detailed view link if scraping multiple days is too complex for standard regex */}} -
- - Részletes Előrejelzés → - -
-
- + + +
+
+
+
Budapest
+
{{ now | formatTime "Monday, Jan 02" }}
+
+
{{ $temp }}°
+
+ +
+
+ weather +
{{ $cond }}
+
+
+ +
+ ↑ {{ $sunrise }} + ↓ {{ $sunset }} +
+ + {{/* Daily Forecast Rows (Day 1 and 2 shown as examples) */}} +
+ {{ $d1_day }} + + {{ $d1_min }}° +
+ {{ $d1_max }}° +
+ +
+ {{ $d2_day }} + + {{ $d2_min }}° +
+ {{ $d2_max }}° +
+ +
+ idokep.hu 30 napos → +
+
# Calendar Widget - type: calendar