auto option

This commit is contained in:
Celogeek 2023-01-15 15:44:33 +01:00
parent 259bf6bb7b
commit eef33a4c40
Signed by: celogeek
GPG Key ID: E6B7BDCFC446233A
2 changed files with 9 additions and 0 deletions

View File

@ -78,6 +78,8 @@ The ePub include as a first page:
Usage of go-comic-converter: Usage of go-comic-converter:
-author string -author string
Author of the epub (default "GO Comic Converter") Author of the epub (default "GO Comic Converter")
-auto
Activate all automatic options
-autorotate -autorotate
Auto Rotate page when width > height Auto Rotate page when width > height
-autosplitdoublepage -autosplitdoublepage

View File

@ -66,6 +66,7 @@ type Option struct {
NoCrop bool NoCrop bool
Brightness int Brightness int
Contrast int Contrast int
Auto bool
AutoRotate bool AutoRotate bool
AutoSplitDoublePage bool AutoSplitDoublePage bool
Workers int Workers int
@ -142,6 +143,7 @@ func main() {
flag.BoolVar(&opt.NoCrop, "nocrop", false, "Disable cropping") flag.BoolVar(&opt.NoCrop, "nocrop", false, "Disable cropping")
flag.IntVar(&opt.Brightness, "brightness", 0, "Brightness readjustement: between -100 and 100, > 0 lighter, < 0 darker") flag.IntVar(&opt.Brightness, "brightness", 0, "Brightness readjustement: between -100 and 100, > 0 lighter, < 0 darker")
flag.IntVar(&opt.Contrast, "contrast", 0, "Contrast readjustement: between -100 and 100, > 0 more contrast, < 0 less contrast") flag.IntVar(&opt.Contrast, "contrast", 0, "Contrast readjustement: between -100 and 100, > 0 more contrast, < 0 less contrast")
flag.BoolVar(&opt.Auto, "auto", false, "Activate all automatic options")
flag.BoolVar(&opt.AutoRotate, "autorotate", false, "Auto Rotate page when width > height") flag.BoolVar(&opt.AutoRotate, "autorotate", false, "Auto Rotate page when width > height")
flag.BoolVar(&opt.AutoSplitDoublePage, "autosplitdoublepage", false, "Auto Split double page when width > height") flag.BoolVar(&opt.AutoSplitDoublePage, "autosplitdoublepage", false, "Auto Split double page when width > height")
flag.IntVar(&opt.LimitMb, "limitmb", 0, "Limit size of the ePub: Default nolimit (0), Minimum 20") flag.IntVar(&opt.LimitMb, "limitmb", 0, "Limit size of the ePub: Default nolimit (0), Minimum 20")
@ -226,6 +228,11 @@ func main() {
opt.Title = filepath.Base(defaultOutput[0 : len(defaultOutput)-len(ext)]) opt.Title = filepath.Base(defaultOutput[0 : len(defaultOutput)-len(ext)])
} }
if opt.Auto {
opt.AutoRotate = true
opt.AutoSplitDoublePage = true
}
fmt.Fprintln(os.Stderr, opt) fmt.Fprintln(os.Stderr, opt)
if err := epub.NewEpub(&epub.EpubOptions{ if err := epub.NewEpub(&epub.EpubOptions{