From eabd42300685e1c325fd76463033b7a25fbdf0a5 Mon Sep 17 00:00:00 2001 From: milarin Date: Fri, 13 Jan 2023 20:04:57 +0100 Subject: [PATCH] debug output --- handle_file.go | 5 ++++- main.go | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/handle_file.go b/handle_file.go index bfa3571..2221543 100644 --- a/handle_file.go +++ b/handle_file.go @@ -13,7 +13,7 @@ import ( "git.milar.in/nyaanime/parsers" ) -func HandleFile(path string) { +func HandleFile(path string) bool { for _, parser := range parsers.Parsers { parsedFile, ok := parser.FileParser(&parser, path) if !ok { @@ -27,7 +27,10 @@ func HandleFile(path string) { parsedFile.Anime = anime HandleParsedFile(parsedFile) + return true } + + return false } func HandleParsedFile(parsedFile *model.ParsedFile) { diff --git a/main.go b/main.go index 2430264..0fa1604 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,8 @@ package main import ( + "fmt" + "git.milar.in/nyaanime/logic" "github.com/fsnotify/fsnotify" ) @@ -17,6 +19,12 @@ func main() { } for file := range fsChan { - HandleFile(file) + fmt.Print("file found:", file) + + fileHandled := HandleFile(file) + + if !fileHandled { + fmt.Print("file ignored:", file) + } } }