31 lines
584 B
Go
31 lines
584 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"git.milar.in/nyaanime/logic"
|
|
"github.com/fsnotify/fsnotify"
|
|
)
|
|
|
|
func main() {
|
|
// get access token once at startup to be sure that an access token is obtainable at all
|
|
if _, err := logic.GetAnilistAccessToken(); err != nil {
|
|
panic(err) // TODO error handling
|
|
}
|
|
|
|
fsChan, err := WatchDirectory(fsnotify.Create, DownloadPath)
|
|
if err != nil {
|
|
panic(err) // TODO error handling
|
|
}
|
|
|
|
for file := range fsChan {
|
|
fmt.Println("file found:", file)
|
|
|
|
fileHandled := HandleFile(file)
|
|
|
|
if !fileHandled {
|
|
fmt.Println("file ignored:", file)
|
|
}
|
|
}
|
|
}
|