aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Mathes <adam@trenchant.org>2017-01-26 20:31:31 -0800
committerAdam Mathes <adam@trenchant.org>2017-01-26 20:31:31 -0800
commitd2e503d30302431d8c64aafec94e622cdb503149 (patch)
treee8d97d0053e103fda4de7ffdb0abc2a13253a473
parent66b37908f062eef46594d52a905cd2bde55dd505 (diff)
downloadneko-d2e503d30302431d8c64aafec94e622cdb503149.tar.gz
neko-d2e503d30302431d8c64aafec94e622cdb503149.tar.bz2
neko-d2e503d30302431d8c64aafec94e622cdb503149.zip
add import cmd for feed list to start
-rw-r--r--Makefile1
-rw-r--r--cmd/nekoimport.go27
2 files changed, 28 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 57c4c2a..4cc804e 100644
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,7 @@ $(BINARIES): $(SOURCES)
go build
go build cmd/nekoweb.go
go build cmd/nekocrawl.go
+ go build cmd/nekoimport.go
.PHONY: deps run
diff --git a/cmd/nekoimport.go b/cmd/nekoimport.go
new file mode 100644
index 0000000..c599478
--- /dev/null
+++ b/cmd/nekoimport.go
@@ -0,0 +1,27 @@
+package main
+
+import (
+ _ "neko/util"
+ "neko/models/feed"
+ "fmt"
+ "io/ioutil"
+ "log"
+ "os"
+ "strings"
+)
+
+func main() {
+ if len(os.Args) < 2 {
+ fmt.Printf("usage: nekoimport config.json <feeds.txt>\n\n format is one URL per line\n")
+ }
+
+ fb, err := ioutil.ReadFile(os.Args[2])
+ if err != nil {
+ log.Fatal("could not read file\n")
+ }
+
+ feeds := strings.Split(string(fb), "\n")
+ for _,f := range feeds {
+ feed.NewFeed(f)
+ }
+}