summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/lspipeline-ng/main.go2
-rw-r--r--cmd/rescribe/gui.go6
-rw-r--r--internal/pipeline/put.go4
-rw-r--r--internal/pipeline/put_test.go2
-rw-r--r--pdf.go4
5 files changed, 10 insertions, 8 deletions
diff --git a/cmd/lspipeline-ng/main.go b/cmd/lspipeline-ng/main.go
index 632e6ca..bf6a4bd 100644
--- a/cmd/lspipeline-ng/main.go
+++ b/cmd/lspipeline-ng/main.go
@@ -170,7 +170,7 @@ func getBookStatus(conn LsPipeliner) (inprogress []string, done []string, err er
for i, p := range prefixes {
wg.Add(1)
go getBookDetailsChan(conn, &wg, p, donec, inprogressc, errc)
- if i % 30 == 0 {
+ if i%30 == 0 {
wg.Wait()
}
}
diff --git a/cmd/rescribe/gui.go b/cmd/rescribe/gui.go
index 4944e42..654d875 100644
--- a/cmd/rescribe/gui.go
+++ b/cmd/rescribe/gui.go
@@ -12,7 +12,7 @@ import (
"os"
"path/filepath"
"strings"
-
+
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
@@ -80,14 +80,14 @@ func startGui(log log.Logger, cmd string, training string, systess bool, tessdir
if err == nil && uri != nil {
dir.SetText(uri.Path())
}
- }, myWindow)})
+ }, myWindow)
+ })
progressBar := widget.NewProgressBar()
logarea := widget.NewMultiLineEntry()
logarea.Disable()
-
// TODO: have the button be pressed if enter is pressed
gobtn = widget.NewButtonWithIcon("Process OCR", theme.UploadIcon(), func() {
if dir.Text == "" {
diff --git a/internal/pipeline/put.go b/internal/pipeline/put.go
index 444735a..1be36f0 100644
--- a/internal/pipeline/put.go
+++ b/internal/pipeline/put.go
@@ -80,7 +80,9 @@ func DetectQueueType(dir string, conn Queuer) string {
// UploadImages uploads all files (except those which start with a ".")
// from a directory (recursively) into conn.WIPStorageId(), prefixed with
-// the given bookname and a slash
+// the given bookname and a slash. It also appends all file names with
+// sequential numbers, like 0001, to ensure they are appropriately named
+// for further processing in the pipeline.
func UploadImages(dir string, bookname string, conn Uploader) error {
files, err := ioutil.ReadDir(dir)
if err != nil {
diff --git a/internal/pipeline/put_test.go b/internal/pipeline/put_test.go
index 5fb5b43..66fa0c2 100644
--- a/internal/pipeline/put_test.go
+++ b/internal/pipeline/put_test.go
@@ -77,7 +77,7 @@ func Test_DetectQueueType(t *testing.T) {
func Test_UploadImages(t *testing.T) {
var slog StrLog
- vlog := log.New(&slog, "", 0)
+ vlog := log.New(&slog, "", 0)
var conns []connection
conns = append(conns, connection{name: "local", c: &bookpipeline.LocalConn{Logger: vlog}})
diff --git a/pdf.go b/pdf.go
index 6543e35..72d6428 100644
--- a/pdf.go
+++ b/pdf.go
@@ -87,7 +87,7 @@ func (p *Fpdf) AddPage(imgpath, hocrpath string, smaller bool) error {
b := img.Bounds()
- smallerImgWidth := b.Max.X*smallerImgHeight/b.Max.Y
+ smallerImgWidth := b.Max.X * smallerImgHeight / b.Max.Y
if smaller {
r := image.Rect(0, 0, smallerImgWidth, smallerImgHeight)
smimg := image.NewRGBA(r)
@@ -128,7 +128,7 @@ func (p *Fpdf) AddPage(imgpath, hocrpath string, smaller bool) error {
// Adding a space after each word causes fewer line breaks to
// be erroneously inserted when copy pasting from the PDF, for
// some reason.
- p.fpdf.CellFormat(cellW, lineheight, cellText + " ", "", 0, "T", false, 0, "")
+ p.fpdf.CellFormat(cellW, lineheight, cellText+" ", "", 0, "T", false, 0, "")
}
}
return p.fpdf.Error()