diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-08-03 14:35:02 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-08-03 14:35:02 (GMT) |
commit | d8ae5f3ec954800ecdf613860f761beb5acf7caf (patch) | |
tree | 09b55ff7aa830ab4ffb318703ac701ad352f695b /src | |
parent | 41d0e0fc33aea9c2c584ad0a2e0da1ab802a4a68 (diff) |
get sorted list of carts
Diffstat (limited to 'src')
-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) + + } } |