From 634f13582e0e5bb12fd66a7da8b689eee89a5412 Mon Sep 17 00:00:00 2001 From: Antoine Aflalo <197810+Belphemur@users.noreply.github.com> Date: Tue, 27 Aug 2024 13:27:50 -0400 Subject: [PATCH] refactor: change package name --- cbz/cbz_creator.go | 4 +- cbz/cbz_creator_test.go | 20 +++++----- cbz/cbz_loader.go | 8 ++-- cmd/convert_cbz_command_test.go | 4 +- cmd/rootcmd.go | 12 ++++++ converter/converter.go | 4 +- converter/converter_test.go | 28 ++++++------- converter/webp/webp_converter.go | 2 +- go.mod | 21 ++++++++-- go.sum | 62 +++++++++++++++++++++++++---- {packer => manga}/chapter.go | 2 +- {packer => manga}/page.go | 2 +- {packer => manga}/page_container.go | 2 +- 13 files changed, 122 insertions(+), 49 deletions(-) rename {packer => manga}/chapter.go (97%) rename {packer => manga}/page.go (98%) rename {packer => manga}/page_container.go (97%) diff --git a/cbz/cbz_creator.go b/cbz/cbz_creator.go index 8d20c3d..175a3bd 100644 --- a/cbz/cbz_creator.go +++ b/cbz/cbz_creator.go @@ -3,12 +3,12 @@ package cbz import ( "archive/zip" "fmt" - "github.com/belphemur/CBZOptimizer/packer" + "github.com/belphemur/CBZOptimizer/manga" "os" "time" ) -func WriteChapterToCBZ(chapter *packer.Chapter, outputFilePath string) error { +func WriteChapterToCBZ(chapter *manga.Chapter, outputFilePath string) error { // Create a new ZIP file zipFile, err := os.Create(outputFilePath) if err != nil { diff --git a/cbz/cbz_creator_test.go b/cbz/cbz_creator_test.go index 96de5de..c0337d4 100644 --- a/cbz/cbz_creator_test.go +++ b/cbz/cbz_creator_test.go @@ -3,7 +3,7 @@ package cbz import ( "archive/zip" "bytes" - "github.com/belphemur/CBZOptimizer/packer" + "github.com/belphemur/CBZOptimizer/manga" "os" "testing" "time" @@ -13,14 +13,14 @@ func TestWriteChapterToCBZ(t *testing.T) { // Define test cases testCases := []struct { name string - chapter *packer.Chapter + chapter *manga.Chapter expectedFiles []string }{ //test case where there is only one page and ComicInfo and the chapter is converted { name: "Single page, ComicInfo, converted", - chapter: &packer.Chapter{ - Pages: []*packer.Page{ + chapter: &manga.Chapter{ + Pages: []*manga.Page{ { Index: 0, Extension: ".jpg", @@ -36,8 +36,8 @@ func TestWriteChapterToCBZ(t *testing.T) { //test case where there is only one page and no { name: "Single page, no ComicInfo", - chapter: &packer.Chapter{ - Pages: []*packer.Page{ + chapter: &manga.Chapter{ + Pages: []*manga.Page{ { Index: 0, Extension: ".jpg", @@ -49,8 +49,8 @@ func TestWriteChapterToCBZ(t *testing.T) { }, { name: "Multiple pages with ComicInfo", - chapter: &packer.Chapter{ - Pages: []*packer.Page{ + chapter: &manga.Chapter{ + Pages: []*manga.Page{ { Index: 0, Extension: ".jpg", @@ -68,8 +68,8 @@ func TestWriteChapterToCBZ(t *testing.T) { }, { name: "Split page", - chapter: &packer.Chapter{ - Pages: []*packer.Page{ + chapter: &manga.Chapter{ + Pages: []*manga.Page{ { Index: 0, Extension: ".jpg", diff --git a/cbz/cbz_loader.go b/cbz/cbz_loader.go index 3b936bf..7c6421e 100644 --- a/cbz/cbz_loader.go +++ b/cbz/cbz_loader.go @@ -6,13 +6,13 @@ import ( "bytes" "fmt" "github.com/araddon/dateparse" - "github.com/belphemur/CBZOptimizer/packer" + "github.com/belphemur/CBZOptimizer/manga" "io" "path/filepath" "strings" ) -func LoadChapter(filePath string) (*packer.Chapter, error) { +func LoadChapter(filePath string) (*manga.Chapter, error) { // Open the .cbz file r, err := zip.OpenReader(filePath) if err != nil { @@ -20,7 +20,7 @@ func LoadChapter(filePath string) (*packer.Chapter, error) { } defer r.Close() - chapter := &packer.Chapter{ + chapter := &manga.Chapter{ FilePath: filePath, } @@ -71,7 +71,7 @@ func LoadChapter(filePath string) (*packer.Chapter, error) { } // Create a new Page object - page := &packer.Page{ + page := &manga.Page{ Index: uint16(len(chapter.Pages)), // Simple index based on order Extension: ext, Size: uint64(buf.Len()), diff --git a/cmd/convert_cbz_command_test.go b/cmd/convert_cbz_command_test.go index 6f18543..f7f532a 100644 --- a/cmd/convert_cbz_command_test.go +++ b/cmd/convert_cbz_command_test.go @@ -4,7 +4,7 @@ import ( "github.com/belphemur/CBZOptimizer/cbz" "github.com/belphemur/CBZOptimizer/converter" "github.com/belphemur/CBZOptimizer/converter/constant" - "github.com/belphemur/CBZOptimizer/packer" + "github.com/belphemur/CBZOptimizer/manga" "github.com/spf13/cobra" "log" "os" @@ -21,7 +21,7 @@ func (m *MockConverter) Format() constant.ConversionFormat { return constant.WebP } -func (m *MockConverter) ConvertChapter(chapter *packer.Chapter, quality uint8, progress func(string)) (*packer.Chapter, error) { +func (m *MockConverter) ConvertChapter(chapter *manga.Chapter, quality uint8, progress func(string)) (*manga.Chapter, error) { // Simulate conversion by setting the IsConverted flag chapter.IsConverted = true chapter.ConvertedTime = time.Now() diff --git a/cmd/rootcmd.go b/cmd/rootcmd.go index 745ab82..5fe0845 100644 --- a/cmd/rootcmd.go +++ b/cmd/rootcmd.go @@ -3,6 +3,7 @@ package cmd import ( "fmt" "github.com/spf13/cobra" + "github.com/spf13/viper" "os" ) @@ -11,6 +12,17 @@ var rootCmd = &cobra.Command{ Short: "Convert CBZ files using a specified converter", } +func init() { + viper.SetConfigName("CBZOptimizer") + viper.SetConfigType("yaml") + viper.SetEnvPrefix("CBZ") + viper.AutomaticEnv() + err := viper.ReadInConfig() // Find and read the config file + if err != nil { // Handle errors reading the config file + panic(fmt.Errorf("fatal error config file: %w", err)) + } +} + // Execute executes the root command. func Execute() { if err := rootCmd.Execute(); err != nil { diff --git a/converter/converter.go b/converter/converter.go index 10c2afc..286353a 100644 --- a/converter/converter.go +++ b/converter/converter.go @@ -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 } diff --git a/converter/converter_test.go b/converter/converter_test.go index fe476a6..5775207 100644 --- a/converter/converter_test.go +++ b/converter/converter_test.go @@ -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 diff --git a/converter/webp/webp_converter.go b/converter/webp/webp_converter.go index ceb89f3..09bc48c 100644 --- a/converter/webp/webp_converter.go +++ b/converter/webp/webp_converter.go @@ -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" diff --git a/go.mod b/go.mod index ffda472..be0d182 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,11 @@ go 1.23.0 require ( github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de + github.com/belphemur/go-webpbin v0.0.0-20240827154654-457b3fe588c4 github.com/oliamb/cutter v0.2.2 github.com/samber/lo v1.47.0 github.com/spf13/cobra v1.8.1 + github.com/spf13/viper v1.19.0 github.com/thediveo/enumflag/v2 v2.0.5 golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 golang.org/x/image v0.19.0 @@ -15,19 +17,32 @@ require ( require ( github.com/andybalholm/brotli v1.1.0 // indirect github.com/belphemur/go-binwrapper v0.0.0-20240827152605-33977349b1f0 // indirect - github.com/belphemur/go-webpbin v0.0.0-20240827154654-457b3fe588c4 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/golang/snappy v0.0.4 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jfrog/archiver/v3 v3.6.1 // indirect github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/pgzip v1.2.6 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/nwaples/rardecode v1.1.3 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pierrec/lz4/v4 v4.1.21 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/subosito/gotenv v1.6.0 // indirect github.com/ulikunitz/xz v0.5.12 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.9.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.17.0 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 4ae33cc..1b4c188 100644 --- a/go.sum +++ b/go.sum @@ -4,19 +4,22 @@ github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de h1:FxWPpzIjnTlhP github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de/go.mod h1:DCaWoUhZrYW9p1lxo/cm8EmUOOzAPSEZNGF2DK1dJgw= github.com/belphemur/go-binwrapper v0.0.0-20240827152605-33977349b1f0 h1:EzKgPYK90TyAOmytK7bvapqlkG/m7KWKK28mOAdQEaM= github.com/belphemur/go-binwrapper v0.0.0-20240827152605-33977349b1f0/go.mod h1:s2Dv+CfgVbNM9ucqvE5qCCC0AkI1PE2OZb7N8PPlOh4= -github.com/belphemur/go-webpbin v0.0.0-20240827154032-5b9e95153dbb h1:vJZcAc1YHLosZwmYHn+LP50SdjpsCjoHZhP8+5yxL2g= -github.com/belphemur/go-webpbin v0.0.0-20240827154032-5b9e95153dbb/go.mod h1:lDnzHELZjEX11ccC5WnVHwMRlbX1E2tsQxfnvG32rN4= github.com/belphemur/go-webpbin v0.0.0-20240827154654-457b3fe588c4 h1:Xyf8bTqdR1tIGs4u3LLfUvXfPoVM6A+jHp6Vt/vqHec= github.com/belphemur/go-webpbin v0.0.0-20240827154654-457b3fe588c4/go.mod h1:lDnzHELZjEX11ccC5WnVHwMRlbX1E2tsQxfnvG32rN4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 h1:iFaUwBSo5Svw6L7HYpRu/0lE3e0BaElwnNO1qkNQxBY= github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5/go.mod h1:qssHWj60/X5sZFNxpG4HBPDHVqxNm4DfnCKgrbZOT+s= github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -26,6 +29,8 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jfrog/archiver/v3 v3.6.1 h1:LOxnkw9pOn45DzCbZNFV6K0+6dCsQ0L8mR3ZcujO5eI= @@ -36,7 +41,15 @@ github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ib github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU= github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9lEc= github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= github.com/oliamb/cutter v0.2.2 h1:Lfwkya0HHNU1YLnGv2hTkzHfasrSMkgv4Dn+5rmlk3k= @@ -45,26 +58,51 @@ github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4 github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.28.1 h1:MijcGUbfYuznzK/5R4CPNoUP/9Xvuo20sXfEm6XxoTA= github.com/onsi/gomega v1.28.1/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ= github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc= github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU= github.com/scylladb/termtables v0.0.0-20191203121021-c4c0b6d42ff4/go.mod h1:C1a7PQSMz9NShzorzCiG2fk9+xuCgLkPeCvMHYR2OWg= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/thediveo/enumflag/v2 v2.0.5 h1:VJjvlAqUb6m6mxOrB/0tfBJI0Kvi9wJ8ulh38xK87i8= github.com/thediveo/enumflag/v2 v2.0.5/go.mod h1:0NcG67nYgwwFsAvoQCmezG0J0KaIxZ0f7skg9eLq1DA= github.com/thediveo/success v1.0.1 h1:NVwUOwKUwaN8szjkJ+vsiM2L3sNBFscldoDJ2g2tAPg= @@ -74,20 +112,28 @@ github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA= golang.org/x/exp v0.0.0-20240823005443-9b4947da3948/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/image v0.19.0 h1:D9FX4QWkLfkeqaC62SonffIIuYdOk/UE2XKUBgRIBIQ= golang.org/x/image v0.19.0/go.mod h1:y0zrRqlQRWQ5PXaYCOMLTW2fpsxZ8Qh9I/ohnInJEys= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/packer/chapter.go b/manga/chapter.go similarity index 97% rename from packer/chapter.go rename to manga/chapter.go index c7c1c41..57a09d0 100644 --- a/packer/chapter.go +++ b/manga/chapter.go @@ -1,4 +1,4 @@ -package packer +package manga import "time" diff --git a/packer/page.go b/manga/page.go similarity index 98% rename from packer/page.go rename to manga/page.go index d99d0b9..b687768 100644 --- a/packer/page.go +++ b/manga/page.go @@ -1,4 +1,4 @@ -package packer +package manga import "bytes" diff --git a/packer/page_container.go b/manga/page_container.go similarity index 97% rename from packer/page_container.go rename to manga/page_container.go index 58cbe8b..7fb21e2 100644 --- a/packer/page_container.go +++ b/manga/page_container.go @@ -1,4 +1,4 @@ -package packer +package manga import "image"