Merge pull request #3 from mgrove36/feat-change-published-calendar-name

[FEAT] Allow changing published name of calendar
This commit is contained in:
Yung Wood
2024-09-01 22:33:01 +09:30
committed by GitHub
2 changed files with 11 additions and 4 deletions

View File

@@ -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)