summaryrefslogtreecommitdiffstats
path: root/feed
diff options
context:
space:
mode:
authorsiddharth <s@ricketyspace.net>2021-11-28 20:14:34 -0500
committersiddharth <s@ricketyspace.net>2021-11-28 20:15:35 -0500
commit03cf36f11d7f09ccccbe52b2793b2c3f322d656a (patch)
tree232d9af00e0960ee63cc216c5ceec1d129e0f7da /feed
parentc1ace352e8ba09ec3c00317e72de6b871a8964ec (diff)
feed: update feed
Add YDLPath to Feed. Set it during Validate().
Diffstat (limited to 'feed')
-rw-r--r--feed/feed.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/feed/feed.go b/feed/feed.go
index 631783b..3872af4 100644
--- a/feed/feed.go
+++ b/feed/feed.go
@@ -19,12 +19,17 @@ type Feed struct {
Id string `json:"id"`
Source string `json:"source"`
Schema string `json:"schema"`
+ YDLPath string
DumpDir string
Object interface{}
}
-func (feed *Feed) Validate(baseDumpDir string) error {
- _, err := os.Stat(baseDumpDir)
+func (feed *Feed) Validate(ydlPath, baseDumpDir string) error {
+ _, err := os.Stat(ydlPath)
+ if err != nil {
+ return err
+ }
+ _, err = os.Stat(baseDumpDir)
if err != nil {
return err
}
@@ -51,6 +56,9 @@ func (feed *Feed) Validate(baseDumpDir string) error {
feed.Schema, 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)