mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-25 00:02:37 +02:00
remove panelview
This commit is contained in:
parent
b9115f7f6f
commit
ed1a312027
@ -124,7 +124,6 @@ Options:
|
|||||||
NoBlankPage : false
|
NoBlankPage : false
|
||||||
Manga : true
|
Manga : true
|
||||||
HasCover : true
|
HasCover : true
|
||||||
AddPanelView : false
|
|
||||||
LimitMb : 200 Mb
|
LimitMb : 200 Mb
|
||||||
StripFirstDirectoryFromToc: true
|
StripFirstDirectoryFromToc: true
|
||||||
SortPathMode : path=alphanum, file=alpha
|
SortPathMode : path=alphanum, file=alpha
|
||||||
@ -162,7 +161,6 @@ Options:
|
|||||||
NoBlankPage : false
|
NoBlankPage : false
|
||||||
Manga : true
|
Manga : true
|
||||||
HasCover : true
|
HasCover : true
|
||||||
AddPanelView : false
|
|
||||||
LimitMb : 200 Mb
|
LimitMb : 200 Mb
|
||||||
StripFirstDirectoryFromToc: true
|
StripFirstDirectoryFromToc: true
|
||||||
SortPathMode : path=alphanum, file=alphanum
|
SortPathMode : path=alphanum, file=alphanum
|
||||||
@ -210,7 +208,6 @@ Options:
|
|||||||
NoBlankPage : false
|
NoBlankPage : false
|
||||||
Manga : false
|
Manga : false
|
||||||
HasCover : true
|
HasCover : true
|
||||||
AddPanelView : false
|
|
||||||
LimitMb : nolimit
|
LimitMb : nolimit
|
||||||
StripFirstDirectoryFromToc: false
|
StripFirstDirectoryFromToc: false
|
||||||
SortPathMode : path=alphanum, file=alpha
|
SortPathMode : path=alphanum, file=alpha
|
||||||
@ -233,7 +230,6 @@ Options:
|
|||||||
NoBlankPage : false
|
NoBlankPage : false
|
||||||
Manga : true
|
Manga : true
|
||||||
HasCover : true
|
HasCover : true
|
||||||
AddPanelView : false
|
|
||||||
LimitMb : 200 Mb
|
LimitMb : 200 Mb
|
||||||
StripFirstDirectoryFromToc: false
|
StripFirstDirectoryFromToc: false
|
||||||
SortPathMode : path=alphanum, file=alpha
|
SortPathMode : path=alphanum, file=alpha
|
||||||
@ -258,7 +254,6 @@ Options:
|
|||||||
NoBlankPage : false
|
NoBlankPage : false
|
||||||
Manga : false
|
Manga : false
|
||||||
HasCover : true
|
HasCover : true
|
||||||
AddPanelView : false
|
|
||||||
LimitMb : 200 Mb
|
LimitMb : 200 Mb
|
||||||
StripFirstDirectoryFromToc: false
|
StripFirstDirectoryFromToc: false
|
||||||
SortPathMode : path=alphanum, file=alpha
|
SortPathMode : path=alphanum, file=alpha
|
||||||
@ -284,7 +279,6 @@ Options:
|
|||||||
NoBlankPage : false
|
NoBlankPage : false
|
||||||
Manga : false
|
Manga : false
|
||||||
HasCover : true
|
HasCover : true
|
||||||
AddPanelView : false
|
|
||||||
LimitMb : nolimit
|
LimitMb : nolimit
|
||||||
|
|
||||||
Reset default to ~/.go-comic-converter.yaml
|
Reset default to ~/.go-comic-converter.yaml
|
||||||
@ -360,8 +354,6 @@ Config:
|
|||||||
Manga mode (right to left)
|
Manga mode (right to left)
|
||||||
-hascover (default true)
|
-hascover (default true)
|
||||||
Has cover. Indicate if your comic have a cover. The first page will be used as a cover and include after the title.
|
Has cover. Indicate if your comic have a cover. The first page will be used as a cover and include after the title.
|
||||||
-addpanelview
|
|
||||||
Add an embeded panel view. On kindle you may not need this option as it is handled by the kindle.
|
|
||||||
-limitmb int
|
-limitmb int
|
||||||
Limit size of the ePub: Default nolimit (0), Minimum 20
|
Limit size of the ePub: Default nolimit (0), Minimum 20
|
||||||
-strip
|
-strip
|
||||||
|
@ -95,7 +95,6 @@ func (c *Converter) InitParse() {
|
|||||||
c.AddBoolParam(&c.Options.NoBlankPage, "noblankpage", c.Options.NoBlankPage, "Remove blank pages")
|
c.AddBoolParam(&c.Options.NoBlankPage, "noblankpage", c.Options.NoBlankPage, "Remove blank pages")
|
||||||
c.AddBoolParam(&c.Options.Manga, "manga", c.Options.Manga, "Manga mode (right to left)")
|
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.")
|
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.")
|
||||||
c.AddBoolParam(&c.Options.AddPanelView, "addpanelview", c.Options.AddPanelView, "Add an embeded panel view. On kindle you may not need this option as it is handled by the kindle.")
|
|
||||||
c.AddIntParam(&c.Options.LimitMb, "limitmb", c.Options.LimitMb, "Limit size of the ePub: Default nolimit (0), Minimum 20")
|
c.AddIntParam(&c.Options.LimitMb, "limitmb", c.Options.LimitMb, "Limit size of the ePub: Default nolimit (0), Minimum 20")
|
||||||
c.AddBoolParam(&c.Options.StripFirstDirectoryFromToc, "strip", c.Options.StripFirstDirectoryFromToc, "Strip first directory from the TOC if only 1")
|
c.AddBoolParam(&c.Options.StripFirstDirectoryFromToc, "strip", c.Options.StripFirstDirectoryFromToc, "Strip first directory from the TOC if only 1")
|
||||||
c.AddIntParam(&c.Options.SortPathMode, "sort", c.Options.SortPathMode, "Sort path mode\n0 = alpha for path and file\n1 = alphanum for path and alpha for file\n2 = alphanum for path and file")
|
c.AddIntParam(&c.Options.SortPathMode, "sort", c.Options.SortPathMode, "Sort path mode\n0 = alpha for path and file\n1 = alphanum for path and alpha for file\n2 = alphanum for path and file")
|
||||||
|
@ -31,7 +31,6 @@ type Options struct {
|
|||||||
NoBlankPage bool `yaml:"no_blank_page"`
|
NoBlankPage bool `yaml:"no_blank_page"`
|
||||||
Manga bool `yaml:"manga"`
|
Manga bool `yaml:"manga"`
|
||||||
HasCover bool `yaml:"has_cover"`
|
HasCover bool `yaml:"has_cover"`
|
||||||
AddPanelView bool `yaml:"add_panel_view"`
|
|
||||||
LimitMb int `yaml:"limit_mb"`
|
LimitMb int `yaml:"limit_mb"`
|
||||||
StripFirstDirectoryFromToc bool `yaml:"strip_first_directory_from_toc"`
|
StripFirstDirectoryFromToc bool `yaml:"strip_first_directory_from_toc"`
|
||||||
SortPathMode int `yaml:"sort_path_mode"`
|
SortPathMode int `yaml:"sort_path_mode"`
|
||||||
@ -61,7 +60,6 @@ func New() *Options {
|
|||||||
NoBlankPage: false,
|
NoBlankPage: false,
|
||||||
Manga: false,
|
Manga: false,
|
||||||
HasCover: true,
|
HasCover: true,
|
||||||
AddPanelView: false,
|
|
||||||
LimitMb: 0,
|
LimitMb: 0,
|
||||||
StripFirstDirectoryFromToc: false,
|
StripFirstDirectoryFromToc: false,
|
||||||
SortPathMode: 1,
|
SortPathMode: 1,
|
||||||
@ -150,7 +148,6 @@ func (o *Options) ShowDefault() string {
|
|||||||
NoBlankPage : %v
|
NoBlankPage : %v
|
||||||
Manga : %v
|
Manga : %v
|
||||||
HasCover : %v
|
HasCover : %v
|
||||||
AddPanelView : %v
|
|
||||||
LimitMb : %s
|
LimitMb : %s
|
||||||
StripFirstDirectoryFromToc: %v
|
StripFirstDirectoryFromToc: %v
|
||||||
SortPathMode : %s`,
|
SortPathMode : %s`,
|
||||||
@ -164,7 +161,6 @@ func (o *Options) ShowDefault() string {
|
|||||||
o.NoBlankPage,
|
o.NoBlankPage,
|
||||||
o.Manga,
|
o.Manga,
|
||||||
o.HasCover,
|
o.HasCover,
|
||||||
o.AddPanelView,
|
|
||||||
limitmb,
|
limitmb,
|
||||||
o.StripFirstDirectoryFromToc,
|
o.StripFirstDirectoryFromToc,
|
||||||
sortpathmode,
|
sortpathmode,
|
||||||
|
@ -27,7 +27,6 @@ type ImageOptions struct {
|
|||||||
NoBlankPage bool
|
NoBlankPage bool
|
||||||
Manga bool
|
Manga bool
|
||||||
HasCover bool
|
HasCover bool
|
||||||
AddPanelView bool
|
|
||||||
Workers int
|
Workers int
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,9 +297,6 @@ func (e *ePub) Write() error {
|
|||||||
"Total": totalParts,
|
"Total": totalParts,
|
||||||
})},
|
})},
|
||||||
}
|
}
|
||||||
if e.AddPanelView {
|
|
||||||
content = append(content, zipContent{"OEBPS/Text/panelview.css", panelViewTmpl})
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = wz.WriteMagic(); err != nil {
|
if err = wz.WriteMagic(); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -317,24 +313,21 @@ func (e *ePub) Write() error {
|
|||||||
wz.WriteImage(part.Cover.Data)
|
wz.WriteImage(part.Cover.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, img := range part.Images {
|
for i, img := range part.Images {
|
||||||
var content string
|
if err := wz.WriteFile(fmt.Sprintf("OEBPS/Text/%d_p%d.xhtml", img.Id, img.Part), e.render(textTmpl, map[string]any{
|
||||||
if e.AddPanelView {
|
"Info": e,
|
||||||
content = e.render(textTmpl, map[string]any{
|
"Image": img,
|
||||||
"Image": img,
|
"Top": fmt.Sprintf("%d", (e.ViewHeight-img.Height)/2),
|
||||||
"Manga": e.Manga,
|
})); err != nil {
|
||||||
})
|
|
||||||
} else {
|
|
||||||
content = e.render(textNoPanelTmpl, map[string]any{
|
|
||||||
"Image": img,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := wz.WriteFile(fmt.Sprintf("OEBPS/Text/%d_p%d.xhtml", img.Id, img.Part), content); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if img.NeedSpace {
|
if err := wz.WriteImage(img.Data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Double Page or Last Image
|
||||||
|
if img.DoublePage || (i+1 == len(part.Images)) {
|
||||||
if err := wz.WriteFile(
|
if err := wz.WriteFile(
|
||||||
fmt.Sprintf("OEBPS/Text/%d_sp.xhtml", img.Id),
|
fmt.Sprintf("OEBPS/Text/%d_sp.xhtml", img.Id),
|
||||||
e.render(blankTmpl, map[string]any{
|
e.render(blankTmpl, map[string]any{
|
||||||
@ -345,10 +338,6 @@ func (e *ePub) Write() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := wz.WriteImage(img.Data); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
bar.Add(1)
|
bar.Add(1)
|
||||||
}
|
}
|
||||||
|
@ -17,17 +17,11 @@ var navTmpl string
|
|||||||
//go:embed "templates/style.css.tmpl"
|
//go:embed "templates/style.css.tmpl"
|
||||||
var styleTmpl string
|
var styleTmpl string
|
||||||
|
|
||||||
//go:embed "templates/panelview.css.tmpl"
|
|
||||||
var panelViewTmpl string
|
|
||||||
|
|
||||||
//go:embed "templates/part.xhtml.tmpl"
|
//go:embed "templates/part.xhtml.tmpl"
|
||||||
var partTmpl string
|
var partTmpl string
|
||||||
|
|
||||||
//go:embed "templates/text.xhtml.tmpl"
|
//go:embed "templates/text.xhtml.tmpl"
|
||||||
var textTmpl string
|
var textTmpl string
|
||||||
|
|
||||||
//go:embed "templates/textnopanel.xhtml.tmpl"
|
|
||||||
var textNoPanelTmpl string
|
|
||||||
|
|
||||||
//go:embed "templates/blank.xhtml.tmpl"
|
//go:embed "templates/blank.xhtml.tmpl"
|
||||||
var blankTmpl string
|
var blankTmpl string
|
||||||
|
@ -1,103 +0,0 @@
|
|||||||
a.app-amzn-magnify {
|
|
||||||
display: inline-block;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#PV {
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#PV-T {
|
|
||||||
top: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#PV-B {
|
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#PV-L {
|
|
||||||
left: 0;
|
|
||||||
width: 49.5%;
|
|
||||||
height: 100%;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
#PV-R {
|
|
||||||
right: 0;
|
|
||||||
width: 49.5%;
|
|
||||||
height: 100%;
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
#PV-TL {
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 49.5%;
|
|
||||||
height: 50%;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
#PV-TR {
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
width: 49.5%;
|
|
||||||
height: 50%;
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
#PV-BL {
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 49.5%;
|
|
||||||
height: 50%;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
#PV-BR {
|
|
||||||
bottom: 0;
|
|
||||||
right: 0;
|
|
||||||
width: 49.5%;
|
|
||||||
height: 50%;
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.PV-P {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
top: 0;
|
|
||||||
position: absolute;
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#PV-TL-P img {
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#PV-TR-P img {
|
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#PV-BL-P img {
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#PV-BR-P img {
|
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
}
|
|
@ -4,38 +4,11 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>Page {{ .Image.Id }}_p{{ .Image.Part}}</title>
|
<title>Page {{ .Image.Id }}_p{{ .Image.Part}}</title>
|
||||||
<link href="style.css" type="text/css" rel="stylesheet"/>
|
<link href="style.css" type="text/css" rel="stylesheet"/>
|
||||||
<link href="panelview.css" type="text/css" rel="stylesheet"/>
|
<meta name="viewport" content="width={{ .Info.ViewWidth }}, height={{ .Info.ViewHeight }}"/>
|
||||||
<meta name="viewport" content="width={{ .Image.Width }}, height={{ .Image.Height }}"/>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>
|
<div style="position:absolute; top:{{ .Top }}px">
|
||||||
<img style="width:{{ .Image.Width }}px; height:{{ .Image.Height }}px" src="../Images/{{ .Image.Id }}_p{{ .Image.Part}}.jpg"/>
|
<img style="width:{{ .Image.Width }}px; height:{{ .Image.Height }}px" src="../Images/{{ .Image.Id }}_p{{ .Image.Part}}.jpg"/>
|
||||||
</div>
|
</div>
|
||||||
<div id="PV">
|
|
||||||
<div id="PV-TL">
|
|
||||||
<a class="app-amzn-magnify" data-app-amzn-magnify='{"targetId":"PV-TL-P", "ordinal":{{ if .Manga }}2{{ else }}1{{ end }}}'></a>
|
|
||||||
</div>
|
|
||||||
<div id="PV-TR">
|
|
||||||
<a class="app-amzn-magnify" data-app-amzn-magnify='{"targetId":"PV-TR-P", "ordinal":{{ if .Manga }}1{{ else }}2{{ end }}}'></a>
|
|
||||||
</div>
|
|
||||||
<div id="PV-BL">
|
|
||||||
<a class="app-amzn-magnify" data-app-amzn-magnify='{"targetId":"PV-BL-P", "ordinal":{{ if .Manga }}4{{ else }}3{{ end }}}'></a>
|
|
||||||
</div>
|
|
||||||
<div id="PV-BR">
|
|
||||||
<a class="app-amzn-magnify" data-app-amzn-magnify='{"targetId":"PV-BR-P", "ordinal":{{ if .Manga }}3{{ else }}4{{ end }}}'></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="PV-P" id="PV-TL-P">
|
|
||||||
<img src="../Images/{{ .Image.Id }}_p{{ .Image.Part}}.jpg" width="{{ zoom .Image.Width 1.5 }}" height="{{ zoom .Image.Height 1.5 }}"/>
|
|
||||||
</div>
|
|
||||||
<div class="PV-P" id="PV-TR-P">
|
|
||||||
<img src="../Images/{{ .Image.Id }}_p{{ .Image.Part}}.jpg" width="{{ zoom .Image.Width 1.5 }}" height="{{ zoom .Image.Height 1.5 }}"/>
|
|
||||||
</div>
|
|
||||||
<div class="PV-P" id="PV-BL-P">
|
|
||||||
<img src="../Images/{{ .Image.Id }}_p{{ .Image.Part}}.jpg" width="{{ zoom .Image.Width 1.5 }}" height="{{ zoom .Image.Height 1.5 }}"/>
|
|
||||||
</div>
|
|
||||||
<div class="PV-P" id="PV-BR-P">
|
|
||||||
<img src="../Images/{{ .Image.Id }}_p{{ .Image.Part}}.jpg" width="{{ zoom .Image.Width 1.5 }}" height="{{ zoom .Image.Height 1.5 }}"/>
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
|
|
||||||
<head>
|
|
||||||
<title>Page {{ .Image.Id }}_p{{ .Image.Part}}</title>
|
|
||||||
<link href="style.css" type="text/css" rel="stylesheet"/>
|
|
||||||
<meta name="viewport" content="width={{ .Image.Width }}, height={{ .Image.Height }}"/>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div>
|
|
||||||
<img style="width:{{ .Image.Width }}px; height:{{ .Image.Height }}px" src="../Images/{{ .Image.Id }}_p{{ .Image.Part}}.jpg"/>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
1
main.go
1
main.go
@ -113,7 +113,6 @@ $ go install github.com/celogeek/go-comic-converter/v%d@%s
|
|||||||
NoBlankPage: cmd.Options.NoBlankPage,
|
NoBlankPage: cmd.Options.NoBlankPage,
|
||||||
Manga: cmd.Options.Manga,
|
Manga: cmd.Options.Manga,
|
||||||
HasCover: cmd.Options.HasCover,
|
HasCover: cmd.Options.HasCover,
|
||||||
AddPanelView: cmd.Options.AddPanelView,
|
|
||||||
Workers: cmd.Options.Workers,
|
Workers: cmd.Options.Workers,
|
||||||
},
|
},
|
||||||
}).Write(); err != nil {
|
}).Write(); err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user