aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/state.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2021-02-21 14:18:14 +0100
committerRené 'Necoro' Neumann <necoro@necoro.eu>2021-02-21 14:18:14 +0100
commit75278be9b54e96d69668214de968a4517f4ab6e6 (patch)
tree245d24219defcfab217bfbddc2c7fc79f2a3a9a2 /internal/feed/state.go
parentce42a79ef59d2cad6a3d1cee628d86b4a76517ae (diff)
downloadfeed2imap-go-75278be9b54e96d69668214de968a4517f4ab6e6.tar.gz
feed2imap-go-75278be9b54e96d69668214de968a4517f4ab6e6.tar.bz2
feed2imap-go-75278be9b54e96d69668214de968a4517f4ab6e6.zip
Slight restructuring
Diffstat (limited to 'internal/feed/state.go')
-rw-r--r--internal/feed/state.go13
1 files changed, 4 insertions, 9 deletions
diff --git a/internal/feed/state.go b/internal/feed/state.go
index 41d8751..364616f 100644
--- a/internal/feed/state.go
+++ b/internal/feed/state.go
@@ -2,12 +2,10 @@ package feed
import (
"encoding/json"
- "fmt"
"sync"
"github.com/mmcdole/gofeed"
- "github.com/Necoro/feed2imap-go/internal/feed/filter"
"github.com/Necoro/feed2imap-go/pkg/config"
"github.com/Necoro/feed2imap-go/pkg/log"
)
@@ -163,14 +161,11 @@ func NewState(cfg *config.Config) (*State, error) {
}
for name, parsedFeed := range cfg.Feeds {
- var itemFilter *filter.Filter
- var err error
- if parsedFeed.ItemFilter != "" {
- if itemFilter, err = filter.New(parsedFeed.ItemFilter); err != nil {
- return nil, fmt.Errorf("Feed %s: Parsing item-filter: %w", parsedFeed.Name, err)
- }
+ feed, err := Create(parsedFeed, cfg.GlobalOptions)
+ if err != nil {
+ return nil, err
}
- state.feeds[name] = &Feed{Feed: parsedFeed, Global: cfg.GlobalOptions, filter: itemFilter}
+ state.feeds[name] = feed
}
return &state, nil