diff options
Diffstat (limited to 'src/file-hasher/main.go')
-rw-r--r-- | src/file-hasher/main.go | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/file-hasher/main.go b/src/file-hasher/main.go index f360705..c7718ee 100644 --- a/src/file-hasher/main.go +++ b/src/file-hasher/main.go @@ -31,9 +31,12 @@ import ( ) type Request struct { - NumThreads uint `json:"threads"` - Directories []string `json:"dir"` - M3UPlaylists []string `json:"m3u"` + NumThreads uint `json:"threads"` + HashAlgo string `json:"algo"` + Sources struct { + Directories []string `json:"dir"` + M3UPlaylists []string `json:"m3u"` + } `json:"src"` } func main() { @@ -53,11 +56,14 @@ func main() { C <- syscall.SIGTERM }() stdlog.Println("***************************************************************") - h := NewHasher(req.NumThreads, stdlog) + h := NewHasher(req.HashAlgo, req.NumThreads, stdlog) + if h == nil { + os.Exit(1) + } stdlog.Println("") stdlog.Println("******************************") - for _, root := range req.Directories { + for _, root := range req.Sources.Directories { src := NewDir(root, stdlog) stdlog.Printf("*** hashing all the files in '%s'", root) stdlog.Println("") @@ -68,7 +74,7 @@ func main() { stdlog.Println("") stdlog.Println("******************************") } - for _, list := range req.M3UPlaylists { + for _, list := range req.Sources.M3UPlaylists { src := NewM3u(list, stdlog) stdlog.Printf("*** hashing all the files from '%s'", list) stdlog.Println("") |