From c8bf5665f43d54dd61f90629d101b954dafe3c89 Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Thu, 5 Jul 2018 20:38:51 -0700 Subject: disable autocrawl since it seems broken --- README.md | 4 +--- main.go | 48 ++++++++++++++++++++++++++---------------------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index f20d94c..af79934 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ You can add feeds directly from the command line for convenience -- ## Crawl Feeds -By default `neko` will crawl your feeds every 60 minutes while the interface is running, but if you want to manually crawl from the command line -- +Update feeds from the command line with -- $ neko --update @@ -159,8 +159,6 @@ Usage of neko: HTTP port to serve on (default 4994) -i, --imageproxy rewrite and proxy all image requests for privacy (experimental) - -m, --minutes int - minutes between crawling feeds (default 60) -p, --password string password to access web interface -u, --update diff --git a/main.go b/main.go index f807afe..8d417ad 100644 --- a/main.go +++ b/main.go @@ -10,13 +10,14 @@ import ( "adammathes.com/neko/web" "fmt" flag "github.com/ogier/pflag" - "time" ) +var Version, Build string + func main() { var help, update, verbose, proxyImages bool var dbfile, newFeed, export, password string - var port, minutes int + var port int // commands // no command tries to run the web server flag.BoolVarP(&help, "help", "h", false, "print usage information") @@ -27,7 +28,7 @@ func main() { // options with sensible defaults flag.StringVarP(&dbfile, "database", "d", "neko.db", "sqlite database file") flag.IntVarP(&port, "http", "s", 4994, "HTTP port to serve on") - flag.IntVarP(&minutes, "minutes", "m", 60, "minutes between crawling feeds") + // flag.IntVarP(&minutes, "minutes", "m", 60, "minutes between crawling feeds") flag.BoolVarP(&proxyImages, "imageproxy", "i", false, "rewrite and proxy all image requests for privacy (experimental)") flag.BoolVarP(&verbose, "verbose", "v", false, "verbose output") @@ -36,6 +37,7 @@ func main() { flag.Parse() if help { + fmt.Printf("neko v%s | build %s\n", Version, Build) flag.Usage() return } @@ -64,25 +66,27 @@ func main() { return } - go func() { - // ticker := time.NewTicker(time.Second*5) - if minutes < 1 { - return - } - ticker := time.NewTicker(time.Minute * time.Duration(minutes)) - defer ticker.Stop() - done := make(chan bool) - for { - select { - case <-done: - fmt.Println("done") - return - case t := <-ticker.C: - vlog.Printf("starting crawl at %s\n", t) - crawler.Crawl() - } - } - }() + // + // this doesn't seem quite right yet // will revise + // go func() { + // // ticker := time.NewTicker(time.Second*5) + // if minutes < 1 { + // return + // } + // ticker := time.NewTicker(time.Minute * time.Duration(minutes)) + // defer ticker.Stop() + // done := make(chan bool) + // for { + // select { + // case <-done: + // fmt.Println("done") + // return + // case t := <-ticker.C: + // vlog.Printf("starting crawl at %s\n", t) + // crawler.Crawl() + // } + // } + // }() vlog.Printf("starting web server at 127.0.0.1:%d\n", config.Config.Port) -- cgit v1.2.3