diff --git a/internal/converter/options/core.go b/internal/converter/options/core.go index 2e372b9..522eea3 100644 --- a/internal/converter/options/core.go +++ b/internal/converter/options/core.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "path/filepath" + "strings" "github.com/celogeek/go-comic-converter/v2/internal/converter/profiles" "gopkg.in/yaml.v3" @@ -111,7 +112,7 @@ func (o *Options) LoadDefault() error { } func (o *Options) ShowDefault() string { - var profileDesc string + var profileDesc, viewDesc string profile := o.GetProfile() if profile != nil { profileDesc = fmt.Sprintf( @@ -121,6 +122,13 @@ func (o *Options) ShowDefault() string { profile.Width, profile.Height, ) + + perfectWidth, perfectHeight := profile.PerfectDim() + viewDesc = fmt.Sprintf( + "%dx%d", + perfectWidth, + perfectHeight, + ) } limitmb := "nolimit" if o.LimitMb > 0 { @@ -139,6 +147,8 @@ func (o *Options) ShowDefault() string { return fmt.Sprintf(` Profile : %s + ViewRatio : 1:%s + View : %s Quality : %d Crop : %v Brightness : %d @@ -152,6 +162,8 @@ func (o *Options) ShowDefault() string { StripFirstDirectoryFromToc: %v SortPathMode : %s`, profileDesc, + strings.TrimRight(fmt.Sprintf("%f", profiles.PerfectRatio), "0"), + viewDesc, o.Quality, o.Crop, o.Brightness, diff --git a/internal/converter/profiles/core.go b/internal/converter/profiles/core.go index e370196..49c68a0 100644 --- a/internal/converter/profiles/core.go +++ b/internal/converter/profiles/core.go @@ -12,11 +12,11 @@ type Profile struct { Height int } -const perfectRatio = 1.5 +const PerfectRatio = 1.5 func (p Profile) PerfectDim() (int, int) { width, height := float64(p.Width), float64(p.Height) - perfectWidth, perfectHeight := height/perfectRatio, width*perfectRatio + perfectWidth, perfectHeight := height/PerfectRatio, width*PerfectRatio if perfectWidth > width { perfectWidth = width } else {