summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorAntonia Karaisl <antonia@rescribe.xyz>2020-07-28 14:15:08 +0100
committerNick White <git@njw.name>2020-07-28 14:15:08 +0100
commita97552ad71454b43abd93b1a985cd0ec6edc5fb4 (patch)
treec34b4364fdde0856c4fcadca8a1325efc93b58eb /cmd
parentca2eaad606ac9ebaa4e827b30deb8881f341c220 (diff)
Autodetect queue for booktopipeline based on file extension
Diffstat (limited to 'cmd')
-rw-r--r--cmd/booktopipeline/main.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/cmd/booktopipeline/main.go b/cmd/booktopipeline/main.go
index 609c3b3..b0605c6 100644
--- a/cmd/booktopipeline/main.go
+++ b/cmd/booktopipeline/main.go
@@ -78,7 +78,7 @@ func main() {
} else {
bookname = filepath.Base(bookdir)
}
-
+
if *verbose {
verboselog = log.New(os.Stdout, "", log.LstdFlags)
} else {
@@ -106,6 +106,19 @@ func main() {
} else {
qid = conn.PreQueueId()
}
+
+ pngdirs, _ := filepath.Glob(bookdir + "/*.png")
+ jpgdirs, _ := filepath.Glob(bookdir + "/*.jpg")
+ pngcount := len(pngdirs)
+ jpgcount := len(jpgdirs)
+ if pngcount > jpgcount {
+ qid = conn.WipeQueueId()
+ fmt.Println("Uploading book to wipe-only queue")
+ } else {
+ qid = conn.PreQueueId()
+ fmt.Println("Uploading book to preprocess queue")
+ }
+
verboselog.Println("Walking", bookdir)
walker := make(fileWalk)