debug logging improved
This commit is contained in:
parent
d526e4d1db
commit
3817f3ac36
BIN
.fuse_hidden000024c600000004
Executable file
BIN
.fuse_hidden000024c600000004
Executable file
Binary file not shown.
@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@ -38,7 +39,6 @@ func HandleParsedFile(parsedFile *model.ParsedFile) {
|
||||
oldFilePrio, animeEpNotExistLocally := logic.GetAnimeEpProps(parsedFile.AnimeEpisode())
|
||||
|
||||
if !animeEpNotExistLocally || newFilePrio.Priority > oldFilePrio.Priority {
|
||||
fmt.Println(animeEpNotExistLocally, newFilePrio, oldFilePrio)
|
||||
go func(parsedFile *model.ParsedFile) {
|
||||
if err := OrganizeAnimeEpisode(parsedFile); err != nil {
|
||||
adverr.Println(err)
|
||||
@ -52,7 +52,7 @@ func OrganizeAnimeEpisode(parsedFile *model.ParsedFile) error {
|
||||
newFile := logic.GetAnimeEpFilepath(parsedFile.AnimeEpisode(), filepath.Ext(parsedFile.File))
|
||||
lockFile := logic.GetAnimeEpFilepath(parsedFile.AnimeEpisode(), "lock")
|
||||
|
||||
fmt.Printf("move file '%s' to '%s'\n", oldFile, newFile)
|
||||
log.Printf("move file '%s' to '%s'\n", oldFile, newFile)
|
||||
|
||||
if err := os.MkdirAll(filepath.Dir(newFile), os.ModePerm); err != nil {
|
||||
return err
|
||||
@ -96,7 +96,7 @@ func OrganizeAnimeEpisode(parsedFile *model.ParsedFile) error {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Printf("file '%s' moved\n", newFile)
|
||||
log.Printf("file '%s' moved\n", newFile)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
6
main.go
6
main.go
@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"git.milar.in/nyaanime/logic"
|
||||
"github.com/fsnotify/fsnotify"
|
||||
@ -22,9 +22,9 @@ func main() {
|
||||
fileHandled := HandleFile(file)
|
||||
|
||||
if fileHandled {
|
||||
fmt.Println("file handled:", file)
|
||||
log.Println("file handled:", file)
|
||||
} else {
|
||||
fmt.Println("file ignored:", file)
|
||||
log.Println("file ignored:", file)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user