aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-25 17:00:57 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-25 17:00:57 +0200
commit573ce1982da2e754947453fdaf0d50204873acb4 (patch)
treef6528235dce77db514ce4442ee8817e993fdcc86 /main.go
parentd21881150c09986571a563eaf30bc1687787e63f (diff)
downloadfeed2imap-go-573ce1982da2e754947453fdaf0d50204873acb4.tar.gz
feed2imap-go-573ce1982da2e754947453fdaf0d50204873acb4.tar.bz2
feed2imap-go-573ce1982da2e754947453fdaf0d50204873acb4.zip
Larger restructuring
Diffstat (limited to 'main.go')
-rw-r--r--main.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/main.go b/main.go
index 1850710..caeafd7 100644
--- a/main.go
+++ b/main.go
@@ -7,11 +7,10 @@ import (
"os"
"sync"
- "github.com/Necoro/feed2imap-go/internal/config"
"github.com/Necoro/feed2imap-go/internal/feed"
"github.com/Necoro/feed2imap-go/internal/imap"
- "github.com/Necoro/feed2imap-go/internal/log"
- "github.com/Necoro/feed2imap-go/internal/yaml"
+ "github.com/Necoro/feed2imap-go/pkg/config"
+ "github.com/Necoro/feed2imap-go/pkg/log"
)
var cfgFile = flag.String("f", "config.yml", "configuration file")
@@ -51,7 +50,7 @@ func run() error {
log.Print("Starting up...")
- cfg, feeds, err := yaml.Load(*cfgFile)
+ cfg, err := config.Load(*cfgFile)
if err != nil {
return err
}
@@ -60,12 +59,14 @@ func run() error {
return fmt.Errorf("Configuration invalid: %w", err)
}
- err = feeds.LoadCache(*cacheFile)
+ state := feed.NewState(cfg)
+
+ err = state.LoadCache(*cacheFile)
if err != nil {
return err
}
- if success := feeds.Parse(); success == 0 {
+ if success := state.Fetch(); success == 0 {
return fmt.Errorf("No successfull feed fetch.")
}
@@ -81,11 +82,11 @@ func run() error {
defer c.Disconnect()
- feeds.ForeachGo(func(f *feed.Feed, wg *sync.WaitGroup) {
+ state.ForeachGo(func(f *feed.Feed, wg *sync.WaitGroup) {
processFeed(f, cfg, c, wg)
})
- if err = feeds.StoreCache(*cacheFile); err != nil {
+ if err = state.StoreCache(*cacheFile); err != nil {
return err
}
class='deletions'>-33/+115 2020-05-10Allow options on group level.René 'Necoro' Neumann3-5/+11 2020-05-10Renamed feed template to html templateRené 'Necoro' Neumann2-2/+2 2020-05-10Release v0.2.0v0.2.0René 'Necoro' Neumann2-2/+6 2020-05-10Fix building cacheRené 'Necoro' Neumann1-1/+3 2020-05-10Update READMERené 'Necoro' Neumann1-5/+44 2020-05-10Ignore 'dist' folder and build productsRené 'Necoro' Neumann1-0/+2 2020-05-08Print item hashes in debug modeRené 'Necoro' Neumann1-1/+7 2020-05-07Improve html renderingRené 'Necoro' Neumann2-53/+32 2020-05-07Do not assume items to be new when their published date is newer than the las...René 'Necoro' Neumann2-7/+1 2020-05-07Updating some depsRené 'Necoro' Neumann2-2/+7 2020-05-07Better detection if a text starts with html or notRené 'Necoro' Neumann2-4/+13 2020-05-07go fmtRené 'Necoro' Neumann1-3/+2 2020-05-07Add header X-Feed2Imap-GUIDRené 'Necoro' Neumann3-1/+7 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