debug output

This commit is contained in:
milarin 2023-01-13 20:04:57 +01:00
parent 523510946d
commit eabd423006
2 changed files with 13 additions and 2 deletions

View File

@ -13,7 +13,7 @@ import (
"git.milar.in/nyaanime/parsers" "git.milar.in/nyaanime/parsers"
) )
func HandleFile(path string) { func HandleFile(path string) bool {
for _, parser := range parsers.Parsers { for _, parser := range parsers.Parsers {
parsedFile, ok := parser.FileParser(&parser, path) parsedFile, ok := parser.FileParser(&parser, path)
if !ok { if !ok {
@ -27,7 +27,10 @@ func HandleFile(path string) {
parsedFile.Anime = anime parsedFile.Anime = anime
HandleParsedFile(parsedFile) HandleParsedFile(parsedFile)
return true
} }
return false
} }
func HandleParsedFile(parsedFile *model.ParsedFile) { func HandleParsedFile(parsedFile *model.ParsedFile) {

10
main.go
View File

@ -1,6 +1,8 @@
package main package main
import ( import (
"fmt"
"git.milar.in/nyaanime/logic" "git.milar.in/nyaanime/logic"
"github.com/fsnotify/fsnotify" "github.com/fsnotify/fsnotify"
) )
@ -17,6 +19,12 @@ func main() {
} }
for file := range fsChan { for file := range fsChan {
HandleFile(file) fmt.Print("file found:", file)
fileHandled := HandleFile(file)
if !fileHandled {
fmt.Print("file ignored:", file)
}
} }
} }