mirror of
https://github.com/Belphemur/CBZOptimizer.git
synced 2025-10-14 04:28:51 +02:00
refactor: change package name
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"github.com/belphemur/CBZOptimizer/converter/constant"
|
||||
"github.com/belphemur/CBZOptimizer/converter/webp"
|
||||
"github.com/belphemur/CBZOptimizer/packer"
|
||||
"github.com/belphemur/CBZOptimizer/manga"
|
||||
"github.com/samber/lo"
|
||||
"strings"
|
||||
)
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
type Converter interface {
|
||||
// Format of the converter
|
||||
Format() (format constant.ConversionFormat)
|
||||
ConvertChapter(chapter *packer.Chapter, quality uint8, progress func(string)) (*packer.Chapter, error)
|
||||
ConvertChapter(chapter *manga.Chapter, quality uint8, progress func(string)) (*manga.Chapter, error)
|
||||
PrepareConverter() error
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,7 @@ package converter
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/belphemur/CBZOptimizer/packer"
|
||||
"github.com/belphemur/CBZOptimizer/manga"
|
||||
"image"
|
||||
"image/jpeg"
|
||||
"os"
|
||||
@@ -13,7 +13,7 @@ func TestConvertChapter(t *testing.T) {
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
genTestChapter func(path string) (*packer.Chapter, error)
|
||||
genTestChapter func(path string) (*manga.Chapter, error)
|
||||
}{
|
||||
{
|
||||
name: "All split pages",
|
||||
@@ -74,14 +74,14 @@ func TestConvertChapter(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func genBigPages(path string) (*packer.Chapter, error) {
|
||||
func genBigPages(path string) (*manga.Chapter, error) {
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
var pages []*packer.Page
|
||||
var pages []*manga.Page
|
||||
for i := 0; i < 5; i++ { // Assuming there are 5 pages for the test
|
||||
img := image.NewRGBA(image.Rect(0, 0, 300, 10000))
|
||||
buf := new(bytes.Buffer)
|
||||
@@ -89,7 +89,7 @@ func genBigPages(path string) (*packer.Chapter, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
page := &packer.Page{
|
||||
page := &manga.Page{
|
||||
Index: uint16(i),
|
||||
Contents: buf,
|
||||
Extension: ".jpg",
|
||||
@@ -97,20 +97,20 @@ func genBigPages(path string) (*packer.Chapter, error) {
|
||||
pages = append(pages, page)
|
||||
}
|
||||
|
||||
return &packer.Chapter{
|
||||
return &manga.Chapter{
|
||||
FilePath: path,
|
||||
Pages: pages,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func genSmallPages(path string) (*packer.Chapter, error) {
|
||||
func genSmallPages(path string) (*manga.Chapter, error) {
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
var pages []*packer.Page
|
||||
var pages []*manga.Page
|
||||
for i := 0; i < 5; i++ { // Assuming there are 5 pages for the test
|
||||
img := image.NewRGBA(image.Rect(0, 0, 300, 1000))
|
||||
buf := new(bytes.Buffer)
|
||||
@@ -118,7 +118,7 @@ func genSmallPages(path string) (*packer.Chapter, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
page := &packer.Page{
|
||||
page := &manga.Page{
|
||||
Index: uint16(i),
|
||||
Contents: buf,
|
||||
Extension: ".jpg",
|
||||
@@ -126,20 +126,20 @@ func genSmallPages(path string) (*packer.Chapter, error) {
|
||||
pages = append(pages, page)
|
||||
}
|
||||
|
||||
return &packer.Chapter{
|
||||
return &manga.Chapter{
|
||||
FilePath: path,
|
||||
Pages: pages,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func genMixSmallBig(path string) (*packer.Chapter, error) {
|
||||
func genMixSmallBig(path string) (*manga.Chapter, error) {
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
var pages []*packer.Page
|
||||
var pages []*manga.Page
|
||||
for i := 0; i < 5; i++ { // Assuming there are 5 pages for the test
|
||||
img := image.NewRGBA(image.Rect(0, 0, 300, 1000*(i+1)))
|
||||
buf := new(bytes.Buffer)
|
||||
@@ -147,7 +147,7 @@ func genMixSmallBig(path string) (*packer.Chapter, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
page := &packer.Page{
|
||||
page := &manga.Page{
|
||||
Index: uint16(i),
|
||||
Contents: buf,
|
||||
Extension: ".jpg",
|
||||
@@ -155,7 +155,7 @@ func genMixSmallBig(path string) (*packer.Chapter, error) {
|
||||
pages = append(pages, page)
|
||||
}
|
||||
|
||||
return &packer.Chapter{
|
||||
return &manga.Chapter{
|
||||
FilePath: path,
|
||||
Pages: pages,
|
||||
}, nil
|
||||
|
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/belphemur/CBZOptimizer/converter/constant"
|
||||
packer2 "github.com/belphemur/CBZOptimizer/packer"
|
||||
packer2 "github.com/belphemur/CBZOptimizer/manga"
|
||||
"github.com/oliamb/cutter"
|
||||
"golang.org/x/exp/slices"
|
||||
_ "golang.org/x/image/webp"
|
||||
|
Reference in New Issue
Block a user