summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/getpipelinebook/main.go44
1 files changed, 15 insertions, 29 deletions
diff --git a/cmd/getpipelinebook/main.go b/cmd/getpipelinebook/main.go
index d7d3e41..faf5383 100644
--- a/cmd/getpipelinebook/main.go
+++ b/cmd/getpipelinebook/main.go
@@ -7,7 +7,6 @@ import (
"log"
"os"
"path/filepath"
- "strings"
"rescribe.xyz/bookpipeline"
)
@@ -41,7 +40,6 @@ type Pipeliner interface {
func main() {
all := flag.Bool("a", false, "Get all files for book")
- colour := flag.Bool("c", false, "Also get the original page images")
verbose := flag.Bool("v", false, "Verbose")
flag.Usage = func() {
fmt.Fprintf(flag.CommandLine.Output(), usage)
@@ -107,7 +105,7 @@ func main() {
}
defer f.Close()
- verboselog.Println("Downloading HOCR and corresponding image files")
+ verboselog.Println("Downloading HOCR files")
s := bufio.NewScanner(f)
for s.Scan() {
fn = filepath.Join(bookname, s.Text())
@@ -116,32 +114,20 @@ func main() {
if err != nil {
log.Fatalln("Failed to download file", fn, err)
}
- b := strings.TrimSuffix(s.Text(), ".hocr")
- fn = filepath.Join(bookname, b + ".png")
- verboselog.Println("Downloading file", fn)
- err = conn.Download(conn.WIPStorageId(), fn, fn)
- if err != nil {
- log.Fatalln("Failed to download file", fn, err)
- }
- if *colour {
- parts := strings.SplitN(s.Text(), "_bin", 2)
- if len(parts) < 2 {
- verboselog.Println("Can't find page number for original page image, skipping", b)
- continue
- }
- num := parts[0]
- fn = filepath.Join(bookname, num + ".jpg")
- verboselog.Println("Downloading file", fn)
- err = conn.Download(conn.WIPStorageId(), fn, fn)
- if err != nil {
- fn = filepath.Join(bookname, num + ".png")
- verboselog.Println("Downloading file", fn)
- err = conn.Download(conn.WIPStorageId(), fn, fn)
- if err != nil {
- log.Fatalln("Failed to download file", fn, err)
- }
- }
- }
+ }
+
+ verboselog.Println("Downloading PDF files")
+ fn = filepath.Join(bookname, bookname + ".colour.pdf")
+ verboselog.Println("Downloading file", fn)
+ err = conn.Download(conn.WIPStorageId(), fn, fn)
+ if err != nil {
+ log.Println("Failed to download %s: %s", fn, err)
+ }
+ fn = filepath.Join(bookname, bookname + ".binarised.pdf")
+ verboselog.Println("Downloading file", fn)
+ err = conn.Download(conn.WIPStorageId(), fn, fn)
+ if err != nil {
+ log.Println("Failed to download %s: %s", fn, err)
}
analyses := []string{"conf", "graph.png"}