gosuki/browsers.go

36 lines
775 B
Go
Raw Normal View History

2017-11-19 16:02:53 +00:00
package main
2017-11-19 20:28:24 +00:00
import (
"database/sql"
fsnotify "gopkg.in/fsnotify.v1"
)
2017-11-19 19:46:24 +00:00
type BrowserType uint8
2017-11-19 16:02:53 +00:00
const (
2017-11-19 20:28:24 +00:00
TChromeBrowser BrowserType = iota
FirefoxBrowser
2017-11-19 16:02:53 +00:00
)
2017-11-19 20:28:24 +00:00
type Browser interface {
New(BrowserType) *Browser // Creates and initialize new browser
Watch() *fsnotify.Watcher // Starts watching bookmarks and runs Load on change
Load() // Loads bookmarks to db without watching
Parse() // Main parsing method
//Parse(...ParseHook) // Main parsing method with different parsing hooks
Close() // Gracefully finish work and stop watching
}
type BaseBrowser struct {
watcher *fsnotify.Watcher
baseDir string
bkFile string
parseFunc func(*Browser)
bufferDB *sql.DB
stats *parserStats
}
type ChromeBrowser struct {
}