aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/parse.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--internal/feed/parse.go20
1 files changed, 3 insertions, 17 deletions
diff --git a/internal/feed/parse.go b/internal/feed/parse.go
index b08c286..a2812bd 100644
--- a/internal/feed/parse.go
+++ b/internal/feed/parse.go
@@ -9,10 +9,9 @@ import (
"github.com/mmcdole/gofeed"
"github.com/Necoro/feed2imap-go/internal/http"
- "github.com/Necoro/feed2imap-go/pkg/log"
)
-func (feed *Feed) parse() error {
+func (feed *Feed) Parse() error {
fp := gofeed.NewParser()
var reader io.Reader
@@ -58,22 +57,9 @@ func (feed *Feed) parse() error {
}
feed.feed = parsedFeed
- feed.items = make([]item, len(parsedFeed.Items))
+ feed.items = make([]Item, len(parsedFeed.Items))
for idx, feedItem := range parsedFeed.Items {
- feed.items[idx] = item{Feed: parsedFeed, Item: feedItem, itemId: uuid.New(), feed: feed}
+ feed.items[idx] = Item{Feed: parsedFeed, feed: feed, Item: feedItem, ID: uuid.New()}
}
return cleanup()
}
-
-func handleFeed(feed *Feed) {
- log.Printf("Fetching %s from %s", feed.Name, feed.Url)
-
- err := feed.parse()
- if err != nil {
- if feed.Url == "" || feed.cached.Failures() >= feed.Global.MaxFailures {
- log.Error(err)
- } else {
- log.Print(err)
- }
- }
-}
an> 2020-05-07update changelogRené 'Necoro' Neumann1-0/+1 2020-05-07FixRené 'Necoro' Neumann1-1/+1 2020-05-07Unified publishedDate and updatedDate into one (just as the old feed2imap...)René 'Necoro' Neumann5-21/+32 2020-05-06Print version during startupRené 'Necoro' Neumann1-1/+1 2020-05-06Improve templateRené 'Necoro' Neumann3-20/+28 2020-05-05Fix pipelineRené 'Necoro' Neumann1-2/+5 2020-05-05Make changelog a part of the release pipeline (untested)René 'Necoro' Neumann2-0/+12