diff options
author | Nick White <git@njw.name> | 2020-03-23 11:10:34 +0000 |
---|---|---|
committer | Nick White <git@njw.name> | 2020-03-23 11:10:34 +0000 |
commit | 3372c864237d2bf18ccd18003db2f23645be3d18 (patch) | |
tree | 1775a43f9dbe5840ee8cbb892fbed2342409bbb7 /cmd | |
parent | 148eab7c04a6eddb439ddcdb0a3ba12d03bb625b (diff) |
[getpipelinebook] Add -binarisedpdf and -colourpdf flags
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/getpipelinebook/main.go | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/cmd/getpipelinebook/main.go b/cmd/getpipelinebook/main.go index f1092f8..5438255 100644 --- a/cmd/getpipelinebook/main.go +++ b/cmd/getpipelinebook/main.go @@ -57,6 +57,8 @@ func getpdfs(conn Pipeliner, l *log.Logger, bookname string) { func main() { all := flag.Bool("a", false, "Get all files for book") graph := flag.Bool("graph", false, "Only download graphs (can be used alongside -pdf)") + binarisedpdf := flag.Bool("binarisedpdf", false, "Only download binarised PDF (can be used alongside -graph)") + colourpdf := flag.Bool("colourpdf", false, "Only download colour PDF (can be used alongside -graph)") pdf := flag.Bool("pdf", false, "Only download PDFs (can be used alongside -graph)") png := flag.Bool("png", false, "Only download best binarised png files") verbose := flag.Bool("v", false, "Verbose") @@ -112,8 +114,22 @@ func main() { return } - if *pdf { - getpdfs(conn, verboselog, bookname) + if *binarisedpdf { + fn := filepath.Join(bookname, bookname + ".binarised.pdf") + verboselog.Println("Downloading file", fn) + err = conn.Download(conn.WIPStorageId(), fn, fn) + if err != nil { + log.Fatalln("Failed to download file", fn, err) + } + } + + if *colourpdf { + fn := filepath.Join(bookname, bookname + ".colour.pdf") + verboselog.Println("Downloading file", fn) + err = conn.Download(conn.WIPStorageId(), fn, fn) + if err != nil { + log.Fatalln("Failed to download file", fn, err) + } } if *graph { @@ -125,7 +141,11 @@ func main() { } } - if *pdf || *graph { + if *pdf { + getpdfs(conn, verboselog, bookname) + } + + if *binarisedpdf || *colourpdf || *graph || *pdf { return } |