diff options
-rw-r--r-- | config/config.go | 6 | ||||
-rw-r--r-- | feed/feed.go | 11 |
2 files changed, 6 insertions, 11 deletions
diff --git a/config/config.go b/config/config.go index 3d8c6f1..360d9a6 100644 --- a/config/config.go +++ b/config/config.go @@ -86,11 +86,13 @@ func (config *FernConfig) validate() error { if len(config.Feeds) == 0 { return fmt.Errorf("'feeds' not set in config") } - for _, feed := range config.Feeds { - err = feed.Validate(config.YDLPath, config.DumpDir) + for i, feed := range config.Feeds { + err = feed.Validate(config.DumpDir) if err != nil { return err } + config.Feeds[i].YDLPath = config.YDLPath + config.Feeds[i].DumpDir = feed.DumpDir } return nil diff --git a/feed/feed.go b/feed/feed.go index e306bef..25fc97d 100644 --- a/feed/feed.go +++ b/feed/feed.go @@ -26,12 +26,8 @@ type Feed struct { Entries []schema.Entry } -func (feed *Feed) Validate(ydlPath, baseDumpDir string) error { - _, err := os.Stat(ydlPath) - if err != nil { - return err - } - _, err = os.Stat(baseDumpDir) +func (feed *Feed) Validate(baseDumpDir string) error { + _, err := os.Stat(baseDumpDir) if err != nil { return err } @@ -63,9 +59,6 @@ func (feed *Feed) Validate(ydlPath, baseDumpDir string) error { return fmt.Errorf("'last' not set or 0 in a feed '%s'", feed.Id) } - // Set ydl-path for feed. - feed.YDLPath = ydlPath - // Set dump directory for feed and ensure it exists. feed.DumpDir = path.Join(baseDumpDir, feed.Id) err = os.MkdirAll(feed.DumpDir, 0755) |