diff --git a/ambrowse.go b/ambrowse.go index 6faf473..e1ada51 100644 --- a/ambrowse.go +++ b/ambrowse.go @@ -1,15 +1,16 @@ package main import ( - goutil "git.gutmet.org/goutil.git/html" - "git.gutmet.org/goutil.git/misc" - "github.com/fsnotify/fsnotify" - "golang.org/x/net/html" "log" "os" "path/filepath" "strings" "time" + + goutil "git.gutmet.org/goutil.git/html" + "git.gutmet.org/goutil.git/misc" + "github.com/fsnotify/fsnotify" + "golang.org/x/net/html" ) const ( @@ -143,13 +144,15 @@ func readHTML(filename string) book { func clean(files []string) { time.Sleep(30 * time.Second) for _, file := range files { + log.Println("Removing", file) os.RemoveAll(file) } } func digest(dir string, created []string) { for _, file := range created { - if filepath.Ext(file) == ".html" && misc.PathExists(file) { + log.Println("Digesting", file) + if fileInfo, err := os.Stat(file); err == nil && !fileInfo.IsDir() { b := readHTML(file) if b.title != "" { err := misc.AppendToFile(filepath.Join(dir, BOOKFILE), b.yaml())