rename splitted to split

This commit is contained in:
Celogeek 2024-02-08 20:49:35 +02:00
parent b6db09aa9e
commit ca73ac9682
Signed by: celogeek
SSH Key Fingerprint: SHA256:DEDfxIK2nUWXbslbRkww3zsauDjhWHlTXar+ak4lDJ4
7 changed files with 75 additions and 75 deletions

View File

@ -118,7 +118,7 @@ func (c *Converter) InitParse() {
c.AddBoolParam(&c.Options.AutoContrast, "autocontrast", c.Options.AutoContrast, "Improve contrast automatically")
c.AddBoolParam(&c.Options.AutoRotate, "autorotate", c.Options.AutoRotate, "Auto Rotate page when width > height")
c.AddBoolParam(&c.Options.AutoSplitDoublePage, "autosplitdoublepage", c.Options.AutoSplitDoublePage, "Auto Split double page when width > height")
c.AddBoolParam(&c.Options.KeepDoublePageIfSplitted, "keepdoublepageifsplitted", c.Options.KeepDoublePageIfSplitted, "Keep the double page if split")
c.AddBoolParam(&c.Options.KeepDoublePageIfSplit, "keepdoublepageifsplit", c.Options.KeepDoublePageIfSplit, "Keep the double page if split")
c.AddBoolParam(&c.Options.NoBlankImage, "noblankimage", c.Options.NoBlankImage, "Remove blank image")
c.AddBoolParam(&c.Options.Manga, "manga", c.Options.Manga, "Manga mode (right to left)")
c.AddBoolParam(&c.Options.HasCover, "hascover", c.Options.HasCover, "Has cover. Indicate if your comic have a cover. The first page will be used as a cover and include after the title.")
@ -270,7 +270,7 @@ func (c *Converter) Parse() {
if c.Options.AppleBookCompatibility {
c.Options.AutoSplitDoublePage = true
c.Options.KeepDoublePageIfSplitted = false
c.Options.KeepDoublePageIfSplit = false
}
}

View File

@ -36,7 +36,7 @@ type Options struct {
AutoContrast bool `yaml:"auto_contrast"`
AutoRotate bool `yaml:"auto_rotate"`
AutoSplitDoublePage bool `yaml:"auto_split_double_page"`
KeepDoublePageIfSplitted bool `yaml:"keep_double_page_if_splitted"`
KeepDoublePageIfSplit bool `yaml:"keep_double_page_if_split"`
NoBlankImage bool `yaml:"no_blank_image"`
Manga bool `yaml:"manga"`
HasCover bool `yaml:"has_cover"`
@ -91,7 +91,7 @@ func New() *Options {
CropRatioBottom: 3,
NoBlankImage: true,
HasCover: true,
KeepDoublePageIfSplitted: true,
KeepDoublePageIfSplit: true,
SortPathMode: 1,
ForegroundColor: "000",
BackgroundColor: "FFF",
@ -173,7 +173,7 @@ func (o *Options) MarshalJSON() ([]byte, error) {
if o.PortraitOnly || !o.AppleBookCompatibility {
out["autosplitdoublepage"] = o.AutoSplitDoublePage
if o.AutoSplitDoublePage {
out["keepdoublepageifsplitted"] = o.KeepDoublePageIfSplitted
out["keepdoublepageifsplit"] = o.KeepDoublePageIfSplit
}
}
if o.LimitMb != 0 {
@ -244,7 +244,7 @@ func (o *Options) ShowConfig() string {
case 1:
titlePage = "always"
case 2:
titlePage = "when epub is splitted"
titlePage = "when epub is split"
}
grayscaleMode := "normal"
@ -265,28 +265,28 @@ func (o *Options) ShowConfig() string {
{"Format", o.Format, true},
{"Quality", o.Quality, o.Format == "jpeg"},
{"Grayscale", o.Grayscale, true},
{"Grayscale Mode", grayscaleMode, o.Grayscale},
{"Grayscale mode", grayscaleMode, o.Grayscale},
{"Crop", o.Crop, true},
{"Crop Ratio", fmt.Sprintf("%d Left - %d Up - %d Right - %d Bottom", o.CropRatioLeft, o.CropRatioUp, o.CropRatioRight, o.CropRatioBottom), o.Crop},
{"Crop ratio", fmt.Sprintf("%d Left - %d Up - %d Right - %d Bottom", o.CropRatioLeft, o.CropRatioUp, o.CropRatioRight, o.CropRatioBottom), o.Crop},
{"Brightness", o.Brightness, o.Brightness != 0},
{"Contrast", o.Contrast, o.Contrast != 0},
{"Auto Contrast", o.AutoContrast, true},
{"Auto Rotate", o.AutoRotate, true},
{"Auto Split DoublePage", o.AutoSplitDoublePage, o.PortraitOnly || !o.AppleBookCompatibility},
{"Keep DoublePage If Splitted", o.KeepDoublePageIfSplitted, (o.PortraitOnly || !o.AppleBookCompatibility) && o.AutoSplitDoublePage},
{"No Blank Image", o.NoBlankImage, true},
{"Auto contrast", o.AutoContrast, true},
{"Auto rotate", o.AutoRotate, true},
{"Auto split double page", o.AutoSplitDoublePage, o.PortraitOnly || !o.AppleBookCompatibility},
{"Keep double page if split", o.KeepDoublePageIfSplit, (o.PortraitOnly || !o.AppleBookCompatibility) && o.AutoSplitDoublePage},
{"No blank image", o.NoBlankImage, true},
{"Manga", o.Manga, true},
{"Has Cover", o.HasCover, true},
{"Has cover", o.HasCover, true},
{"Limit", fmt.Sprintf("%d Mb", o.LimitMb), o.LimitMb != 0},
{"Strip First Directory From Toc", o.StripFirstDirectoryFromToc, true},
{"Sort Path Mode", sortpathmode, true},
{"Foreground Color", fmt.Sprintf("#%s", o.ForegroundColor), true},
{"Background Color", fmt.Sprintf("#%s", o.BackgroundColor), true},
{"Strip first directory from toc", o.StripFirstDirectoryFromToc, true},
{"Sort path mode", sortpathmode, true},
{"Foreground color", fmt.Sprintf("#%s", o.ForegroundColor), true},
{"Background color", fmt.Sprintf("#%s", o.BackgroundColor), true},
{"Resize", !o.NoResize, true},
{"Aspect Ratio", aspectRatio, true},
{"Portrait Only", o.PortraitOnly, true},
{"Title Page", titlePage, true},
{"Apple Book Compatibility", o.AppleBookCompatibility, !o.PortraitOnly},
{"Aspect ratio", aspectRatio, true},
{"Portrait only", o.PortraitOnly, true},
{"Title page", titlePage, true},
{"Apple book compatibility", o.AppleBookCompatibility, !o.PortraitOnly},
} {
if v.Condition {
b.WriteString(fmt.Sprintf("\n %-32s: %v", v.Key, v.Value))

View File

@ -445,7 +445,7 @@ func (e *ePub) Write() error {
// Double Page or Last Image that is not a double page
if !e.Image.View.PortraitOnly &&
(img.DoublePage ||
(!e.Image.KeepDoublePageIfSplitted && img.Part == 1) ||
(!e.Image.KeepDoublePageIfSplit && img.Part == 1) ||
(img.Part == 0 && img == lastImage)) {
if err := e.writeBlank(wz, img); err != nil {
return err

View File

@ -82,7 +82,7 @@ func (e *EPUBImageProcessor) Load() (images []*epubimage.Image, err error) {
// do not keep double page if requested
if !(img.DoublePage && input.Id > 0 &&
e.Options.Image.AutoSplitDoublePage && !e.Options.Image.KeepDoublePageIfSplitted) {
e.Options.Image.AutoSplitDoublePage && !e.Options.Image.KeepDoublePageIfSplit) {
if err = imgStorage.Add(img.EPUBImgPath(), img.Raw, e.Image.Quality); err != nil {
bar.Close()
fmt.Fprintf(os.Stderr, "error with %s: %s", input.Name, err)

View File

@ -29,7 +29,7 @@ type Image struct {
AutoContrast bool
AutoRotate bool
AutoSplitDoublePage bool
KeepDoublePageIfSplitted bool
KeepDoublePageIfSplit bool
NoBlankImage bool
Manga bool
HasCover bool

View File

@ -180,7 +180,7 @@ func getManifest(o *ContentOptions) []tag {
img,
!o.ImageOptions.View.PortraitOnly &&
(img.DoublePage ||
(!o.ImageOptions.KeepDoublePageIfSplitted && img.Part == 1) ||
(!o.ImageOptions.KeepDoublePageIfSplit && img.Part == 1) ||
(img.Part == 0 && img == lastImage)))
}

View File

@ -129,7 +129,7 @@ $ go install github.com/celogeek/go-comic-converter/v%d@%s
AutoContrast: cmd.Options.AutoContrast,
AutoRotate: cmd.Options.AutoRotate,
AutoSplitDoublePage: cmd.Options.AutoSplitDoublePage,
KeepDoublePageIfSplitted: cmd.Options.KeepDoublePageIfSplitted,
KeepDoublePageIfSplit: cmd.Options.KeepDoublePageIfSplit,
NoBlankImage: cmd.Options.NoBlankImage,
Manga: cmd.Options.Manga,
HasCover: cmd.Options.HasCover,