summaryrefslogtreecommitdiff
path: root/src/pool-import/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pool-import/main.go')
-rw-r--r--src/pool-import/main.go22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/pool-import/main.go b/src/pool-import/main.go
index a69c8cc..0a2ce7a 100644
--- a/src/pool-import/main.go
+++ b/src/pool-import/main.go
@@ -74,8 +74,8 @@ func main() {
stdlog.Fatalf("Error '%s' is not a pool group", group)
}
- c := make(chan os.Signal, 1)
- signal.Notify(c, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM)
+ C := make(chan os.Signal, 1)
+ signal.Notify(C, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM)
stdlog.Println("***************************************************************")
stdlog.Printf("*** will import into group '%s' from %d directories", group, len(directories))
@@ -90,5 +90,21 @@ func main() {
for _, cart := range carts {
stdlog.Printf(" %d: '%s' | %s / %s / %s)", cart.Number, cart.UserDefined, cart.Artist, cart.Album, cart.Title)
}
- <-c
+
+ go func() {
+ defer func() {
+ C <- syscall.SIGTERM
+ }()
+
+ for _, root := range directories {
+ stdlog.Printf("hashing all the files in '%s'", root)
+ md := NewMusicDir(root, stdlog)
+ if err := md.ComputeHashes(); err != nil {
+ return
+ }
+ }
+ stdlog.Printf("all directires hashed")
+ }()
+
+ <-C
}