diff options
author | Nick White <git@njw.name> | 2020-08-24 13:35:55 +0100 |
---|---|---|
committer | Nick White <git@njw.name> | 2020-08-24 13:35:55 +0100 |
commit | 48958d281f94b9d8e4b64cbb71bc85d592aea86c (patch) | |
tree | 1b40efef16fe1669846cd2333da4c91e56fbfafc /cmd/getsamplepages/main.go | |
parent | 029752e39023c4a7118f5e244d05faa75e1486d0 (diff) |
update getsamplepages to just get jpg pages
Diffstat (limited to 'cmd/getsamplepages/main.go')
-rw-r--r-- | cmd/getsamplepages/main.go | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/cmd/getsamplepages/main.go b/cmd/getsamplepages/main.go index 55cb8b2..36c7a8e 100644 --- a/cmd/getsamplepages/main.go +++ b/cmd/getsamplepages/main.go @@ -67,22 +67,13 @@ func main() { name := strings.Split(p, "/")[0] log.Printf("Downloading a page from %s\n", name) - for _, n := range []string{"_bin0.0", "_bin0.2", "_bin0.4", "_bin0.5"} { - fn := pgnum + n + ".hocr" - err = conn.Download(conn.WIPStorageId(), p+fn, name+fn) - if err != nil && strings.HasPrefix(err.Error(), "NoSuchKey:") { - continue - } else if err != nil { - log.Fatalf("Download of %s%s failed: %v\n", p+fn, err) - } - - fn = pgnum + n + ".png" - err = conn.Download(conn.WIPStorageId(), p+fn, name+fn) - if err != nil && strings.HasPrefix(err.Error(), "NoSuchKey:") { - continue - } else if err != nil { - log.Fatalf("Download of %s%s failed: %v\n", p+fn, err) - } + fn := pgnum + ".jpg" + err = conn.Download(conn.WIPStorageId(), p+fn, name+fn) + if err != nil && strings.HasPrefix(err.Error(), "NoSuchKey:") { + log.Printf("Skipping %s as no page %s found\n", p, pgnum) + continue + } else if err != nil { + log.Fatalf("Download of %s%s failed: %v\n", p+fn, err) } } } |