mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-25 08:12:36 +02:00
update main script
This commit is contained in:
parent
0946696a8f
commit
f445a26993
40
main.go
40
main.go
@ -14,8 +14,8 @@ import (
|
|||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
|
|
||||||
"github.com/celogeek/go-comic-converter/v2/internal/converter"
|
"github.com/celogeek/go-comic-converter/v2/internal/converter"
|
||||||
"github.com/celogeek/go-comic-converter/v2/internal/epub"
|
"github.com/celogeek/go-comic-converter/v2/pkg/epub"
|
||||||
epuboptions "github.com/celogeek/go-comic-converter/v2/internal/epub/options"
|
"github.com/celogeek/go-comic-converter/v2/pkg/epuboptions"
|
||||||
"github.com/tcnksm/go-latest"
|
"github.com/tcnksm/go-latest"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -106,8 +106,7 @@ $ go install github.com/celogeek/go-comic-converter/v%d@%s
|
|||||||
}
|
}
|
||||||
|
|
||||||
profile := cmd.Options.GetProfile()
|
profile := cmd.Options.GetProfile()
|
||||||
|
options := &epuboptions.EPUBOptions{
|
||||||
if err := epub.New(&epuboptions.Options{
|
|
||||||
Input: cmd.Options.Input,
|
Input: cmd.Options.Input,
|
||||||
Output: cmd.Options.Output,
|
Output: cmd.Options.Output,
|
||||||
LimitMb: cmd.Options.LimitMb,
|
LimitMb: cmd.Options.LimitMb,
|
||||||
@ -122,7 +121,13 @@ $ go install github.com/celogeek/go-comic-converter/v%d@%s
|
|||||||
Quiet: cmd.Options.Quiet,
|
Quiet: cmd.Options.Quiet,
|
||||||
Json: cmd.Options.Json,
|
Json: cmd.Options.Json,
|
||||||
Image: &epuboptions.Image{
|
Image: &epuboptions.Image{
|
||||||
Crop: &epuboptions.Crop{Enabled: cmd.Options.Crop, Left: cmd.Options.CropRatioLeft, Up: cmd.Options.CropRatioUp, Right: cmd.Options.CropRatioRight, Bottom: cmd.Options.CropRatioBottom},
|
Crop: &epuboptions.Crop{
|
||||||
|
Enabled: cmd.Options.Crop,
|
||||||
|
Left: cmd.Options.CropRatioLeft,
|
||||||
|
Up: cmd.Options.CropRatioUp,
|
||||||
|
Right: cmd.Options.CropRatioRight,
|
||||||
|
Bottom: cmd.Options.CropRatioBottom,
|
||||||
|
},
|
||||||
Quality: cmd.Options.Quality,
|
Quality: cmd.Options.Quality,
|
||||||
Brightness: cmd.Options.Brightness,
|
Brightness: cmd.Options.Brightness,
|
||||||
Contrast: cmd.Options.Contrast,
|
Contrast: cmd.Options.Contrast,
|
||||||
@ -133,14 +138,25 @@ $ go install github.com/celogeek/go-comic-converter/v%d@%s
|
|||||||
NoBlankImage: cmd.Options.NoBlankImage,
|
NoBlankImage: cmd.Options.NoBlankImage,
|
||||||
Manga: cmd.Options.Manga,
|
Manga: cmd.Options.Manga,
|
||||||
HasCover: cmd.Options.HasCover,
|
HasCover: cmd.Options.HasCover,
|
||||||
View: &epuboptions.View{Width: profile.Width, Height: profile.Height, AspectRatio: cmd.Options.AspectRatio, PortraitOnly: cmd.Options.PortraitOnly, Color: epuboptions.Color{Foreground: cmd.Options.ForegroundColor, Background: cmd.Options.BackgroundColor}},
|
View: &epuboptions.View{
|
||||||
GrayScale: cmd.Options.Grayscale,
|
Width: profile.Width,
|
||||||
GrayScaleMode: cmd.Options.GrayscaleMode,
|
Height: profile.Height,
|
||||||
Resize: !cmd.Options.NoResize,
|
AspectRatio: cmd.Options.AspectRatio,
|
||||||
Format: cmd.Options.Format,
|
PortraitOnly: cmd.Options.PortraitOnly,
|
||||||
AppleBookCompatibility: cmd.Options.AppleBookCompatibility,
|
Color: epuboptions.Color{
|
||||||
|
Foreground: cmd.Options.ForegroundColor,
|
||||||
|
Background: cmd.Options.BackgroundColor,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
GrayScale: cmd.Options.Grayscale,
|
||||||
|
GrayScaleMode: cmd.Options.GrayscaleMode,
|
||||||
|
Resize: !cmd.Options.NoResize,
|
||||||
|
Format: cmd.Options.Format,
|
||||||
|
AppleBookCompatibility: cmd.Options.AppleBookCompatibility,
|
||||||
},
|
},
|
||||||
}).Write(); err != nil {
|
}
|
||||||
|
|
||||||
|
if err := epub.Generate(options); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user