remove panelview

This commit is contained in:
Celogeek 2023-04-16 11:44:03 +02:00
parent b9115f7f6f
commit ed1a312027
Signed by: celogeek
SSH Key Fingerprint: SHA256:njNJLzoLQdbV9PC6ehcruRb0QnEgxABoCYZ+0+aUIYc
9 changed files with 14 additions and 189 deletions

View File

@ -124,7 +124,6 @@ Options:
NoBlankPage : false
Manga : true
HasCover : true
AddPanelView : false
LimitMb : 200 Mb
StripFirstDirectoryFromToc: true
SortPathMode : path=alphanum, file=alpha
@ -162,7 +161,6 @@ Options:
NoBlankPage : false
Manga : true
HasCover : true
AddPanelView : false
LimitMb : 200 Mb
StripFirstDirectoryFromToc: true
SortPathMode : path=alphanum, file=alphanum
@ -210,7 +208,6 @@ Options:
NoBlankPage : false
Manga : false
HasCover : true
AddPanelView : false
LimitMb : nolimit
StripFirstDirectoryFromToc: false
SortPathMode : path=alphanum, file=alpha
@ -233,7 +230,6 @@ Options:
NoBlankPage : false
Manga : true
HasCover : true
AddPanelView : false
LimitMb : 200 Mb
StripFirstDirectoryFromToc: false
SortPathMode : path=alphanum, file=alpha
@ -258,7 +254,6 @@ Options:
NoBlankPage : false
Manga : false
HasCover : true
AddPanelView : false
LimitMb : 200 Mb
StripFirstDirectoryFromToc: false
SortPathMode : path=alphanum, file=alpha
@ -284,7 +279,6 @@ Options:
NoBlankPage : false
Manga : false
HasCover : true
AddPanelView : false
LimitMb : nolimit
Reset default to ~/.go-comic-converter.yaml
@ -360,8 +354,6 @@ Config:
Manga mode (right to left)
-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.
-addpanelview
Add an embeded panel view. On kindle you may not need this option as it is handled by the kindle.
-limitmb int
Limit size of the ePub: Default nolimit (0), Minimum 20
-strip

View File

@ -95,7 +95,6 @@ func (c *Converter) InitParse() {
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.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.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")

View File

@ -31,7 +31,6 @@ type Options struct {
NoBlankPage bool `yaml:"no_blank_page"`
Manga bool `yaml:"manga"`
HasCover bool `yaml:"has_cover"`
AddPanelView bool `yaml:"add_panel_view"`
LimitMb int `yaml:"limit_mb"`
StripFirstDirectoryFromToc bool `yaml:"strip_first_directory_from_toc"`
SortPathMode int `yaml:"sort_path_mode"`
@ -61,7 +60,6 @@ func New() *Options {
NoBlankPage: false,
Manga: false,
HasCover: true,
AddPanelView: false,
LimitMb: 0,
StripFirstDirectoryFromToc: false,
SortPathMode: 1,
@ -150,7 +148,6 @@ func (o *Options) ShowDefault() string {
NoBlankPage : %v
Manga : %v
HasCover : %v
AddPanelView : %v
LimitMb : %s
StripFirstDirectoryFromToc: %v
SortPathMode : %s`,
@ -164,7 +161,6 @@ func (o *Options) ShowDefault() string {
o.NoBlankPage,
o.Manga,
o.HasCover,
o.AddPanelView,
limitmb,
o.StripFirstDirectoryFromToc,
sortpathmode,

View File

@ -27,7 +27,6 @@ type ImageOptions struct {
NoBlankPage bool
Manga bool
HasCover bool
AddPanelView bool
Workers int
}
@ -298,9 +297,6 @@ func (e *ePub) Write() error {
"Total": totalParts,
})},
}
if e.AddPanelView {
content = append(content, zipContent{"OEBPS/Text/panelview.css", panelViewTmpl})
}
if err = wz.WriteMagic(); err != nil {
return err
@ -317,24 +313,21 @@ func (e *ePub) Write() error {
wz.WriteImage(part.Cover.Data)
}
for _, img := range part.Images {
var content string
if e.AddPanelView {
content = e.render(textTmpl, map[string]any{
"Image": img,
"Manga": e.Manga,
})
} 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 {
for i, img := range part.Images {
if err := wz.WriteFile(fmt.Sprintf("OEBPS/Text/%d_p%d.xhtml", img.Id, img.Part), e.render(textTmpl, map[string]any{
"Info": e,
"Image": img,
"Top": fmt.Sprintf("%d", (e.ViewHeight-img.Height)/2),
})); err != nil {
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(
fmt.Sprintf("OEBPS/Text/%d_sp.xhtml", img.Id),
e.render(blankTmpl, map[string]any{
@ -345,10 +338,6 @@ func (e *ePub) Write() error {
return err
}
}
if err := wz.WriteImage(img.Data); err != nil {
return err
}
}
bar.Add(1)
}

View File

@ -17,17 +17,11 @@ var navTmpl string
//go:embed "templates/style.css.tmpl"
var styleTmpl string
//go:embed "templates/panelview.css.tmpl"
var panelViewTmpl string
//go:embed "templates/part.xhtml.tmpl"
var partTmpl string
//go:embed "templates/text.xhtml.tmpl"
var textTmpl string
//go:embed "templates/textnopanel.xhtml.tmpl"
var textNoPanelTmpl string
//go:embed "templates/blank.xhtml.tmpl"
var blankTmpl string

View File

@ -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;
}

View File

@ -4,38 +4,11 @@
<head>
<title>Page {{ .Image.Id }}_p{{ .Image.Part}}</title>
<link href="style.css" type="text/css" rel="stylesheet"/>
<link href="panelview.css" type="text/css" rel="stylesheet"/>
<meta name="viewport" content="width={{ .Image.Width }}, height={{ .Image.Height }}"/>
<meta name="viewport" content="width={{ .Info.ViewWidth }}, height={{ .Info.ViewHeight }}"/>
</head>
<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"/>
</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>
</html>

View File

@ -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>

View File

@ -113,7 +113,6 @@ $ go install github.com/celogeek/go-comic-converter/v%d@%s
NoBlankPage: cmd.Options.NoBlankPage,
Manga: cmd.Options.Manga,
HasCover: cmd.Options.HasCover,
AddPanelView: cmd.Options.AddPanelView,
Workers: cmd.Options.Workers,
},
}).Write(); err != nil {