diff options
Diffstat (limited to 'src/pool-import/main.go')
-rw-r--r-- | src/pool-import/main.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/pool-import/main.go b/src/pool-import/main.go index dfa6ab5..b184ef3 100644 --- a/src/pool-import/main.go +++ b/src/pool-import/main.go @@ -24,6 +24,7 @@ package main import ( "log" "os" + "sort" "code.helsinki.at/rhrd-go/rddb" "code.helsinki.at/rhrd-go/rhimport" @@ -74,4 +75,22 @@ func main() { } log.Printf("will import: %d carts from old:%s -> new:%s", len(carts), old_group, new_group) + + var keys []int + for k := range carts { + keys = append(keys, int(k)) + } + sort.Ints(keys) + for _, k := range keys { + cart := carts[uint(k)] + if len(cart.Cuts) == 0 { + log.Printf("Warning: Cart %d has no cuts - ingoring it", cart.Number) + continue + } else if len(cart.Cuts) > 1 { + log.Printf("Warning: Cart %d has multiple cuts - will only use the first", cart.Number) + } + cut := cart.Cuts[0].Number + log.Printf(" %06d_%03d: '%s' / '%s' / '%s'", cart.Number, cut, cart.Artist, cart.Album, cart.Title) + + } } |