From f3219064352739699dab7622ce08a69d849fd2a0 Mon Sep 17 00:00:00 2001 From: Matthew Grove Date: Sun, 25 Aug 2024 18:12:27 +0100 Subject: [PATCH] [FEAT] Allow changing published name of calendar Use `publish_name` yaml property at the `calendar` level --- calendar.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/calendar.go b/calendar.go index 3d4dfa1..3041168 100644 --- a/calendar.go +++ b/calendar.go @@ -16,10 +16,11 @@ import ( // CalendarConfig definition type CalendarConfig struct { - Name string `yaml:"name"` - Token string `yaml:"token"` - FeedURL string `yaml:"feed_url"` - Filters []Filter `yaml:"filters"` + Name string `yaml:"name"` + PublishName string `yaml:"publish_name"` + Token string `yaml:"token"` + FeedURL string `yaml:"feed_url"` + Filters []Filter `yaml:"filters"` } // Downloads iCal feed from the URL and applies filtering rules @@ -44,6 +45,10 @@ func (calendarConfig CalendarConfig) fetch() ([]byte, error) { return nil, err } + if (calendarConfig.PublishName != "") { + cal.SetName(calendarConfig.PublishName) + } + // process filters if len(calendarConfig.Filters) > 0 { slog.Debug("Processing filters", "calendar", calendarConfig.Name)