refactor(discovery/crawler): hoist land constants; document Tribe date format assumption

This commit is contained in:
2026-04-18 13:04:28 +02:00
parent 1cc7de0bb6
commit 94aa261c90
3 changed files with 19 additions and 7 deletions

View File

@@ -0,0 +1,11 @@
package crawler
// Land names used in RawEvent/MergedEvent.Land and throughout discovery. ASCII
// forms (Oesterreich, not Österreich) to keep string comparisons and log output
// stable across locales. Defined in one place so every source parser references
// the same constants.
const (
landDeutschland = "Deutschland"
landOesterreich = "Oesterreich"
landSchweiz = "Schweiz"
)

View File

@@ -10,12 +10,6 @@ import (
"github.com/PuerkitoBio/goquery"
)
const (
landDeutschland = "Deutschland"
landOesterreich = "Oesterreich"
landSchweiz = "Schweiz"
)
// MarktkalendariumSource scrapes www.marktkalendarium.de. Table rows:
// Von | Bis | Veranstaltung | Ort | Platz | Webseite | Veranstalter
type MarktkalendariumSource struct {

View File

@@ -168,7 +168,14 @@ func tribeCountryToLand(country string) string {
return ""
}
// parseTribeDate parses the Tribe Events date format "YYYY-MM-DD HH:MM:SS" (local time).
// parseTribeDate parses the Tribe Events JSON date format
// "YYYY-MM-DD HH:MM:SS" in the site's local time. If the site ever switches
// to ISO-8601 with T-separator or an explicit timezone, this function will
// start returning errors and events will be silently dropped. The symptom
// will show up as "eventsFetched > 0 but Discovered = 0" in CrawlSummary —
// at that point switch to the iCal endpoint at
// https://mittelaltermarkt.online/events/?ical=1 which uses the standard
// VEVENT DTSTART format and is more durable across plugin upgrades.
func parseTribeDate(s string) (*time.Time, error) {
s = strings.TrimSpace(s)
if s == "" {