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"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
@ -38,7 +39,6 @@ func HandleParsedFile(parsedFile *model.ParsedFile) {
|
|||||||
oldFilePrio, animeEpNotExistLocally := logic.GetAnimeEpProps(parsedFile.AnimeEpisode())
|
oldFilePrio, animeEpNotExistLocally := logic.GetAnimeEpProps(parsedFile.AnimeEpisode())
|
||||||
|
|
||||||
if !animeEpNotExistLocally || newFilePrio.Priority > oldFilePrio.Priority {
|
if !animeEpNotExistLocally || newFilePrio.Priority > oldFilePrio.Priority {
|
||||||
fmt.Println(animeEpNotExistLocally, newFilePrio, oldFilePrio)
|
|
||||||
go func(parsedFile *model.ParsedFile) {
|
go func(parsedFile *model.ParsedFile) {
|
||||||
if err := OrganizeAnimeEpisode(parsedFile); err != nil {
|
if err := OrganizeAnimeEpisode(parsedFile); err != nil {
|
||||||
adverr.Println(err)
|
adverr.Println(err)
|
||||||
@ -52,7 +52,7 @@ func OrganizeAnimeEpisode(parsedFile *model.ParsedFile) error {
|
|||||||
newFile := logic.GetAnimeEpFilepath(parsedFile.AnimeEpisode(), filepath.Ext(parsedFile.File))
|
newFile := logic.GetAnimeEpFilepath(parsedFile.AnimeEpisode(), filepath.Ext(parsedFile.File))
|
||||||
lockFile := logic.GetAnimeEpFilepath(parsedFile.AnimeEpisode(), "lock")
|
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 {
|
if err := os.MkdirAll(filepath.Dir(newFile), os.ModePerm); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -96,7 +96,7 @@ func OrganizeAnimeEpisode(parsedFile *model.ParsedFile) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("file '%s' moved\n", newFile)
|
log.Printf("file '%s' moved\n", newFile)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
6
main.go
6
main.go
@ -1,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"log"
|
||||||
|
|
||||||
"git.milar.in/nyaanime/logic"
|
"git.milar.in/nyaanime/logic"
|
||||||
"github.com/fsnotify/fsnotify"
|
"github.com/fsnotify/fsnotify"
|
||||||
@ -22,9 +22,9 @@ func main() {
|
|||||||
fileHandled := HandleFile(file)
|
fileHandled := HandleFile(file)
|
||||||
|
|
||||||
if fileHandled {
|
if fileHandled {
|
||||||
fmt.Println("file handled:", file)
|
log.Println("file handled:", file)
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("file ignored:", file)
|
log.Println("file ignored:", file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user