From 0a3f4d6992815950c4cb604294e9dd45d68e4576 Mon Sep 17 00:00:00 2001 From: Milan Nikolic Date: Thu, 24 Aug 2023 11:42:19 +0200 Subject: [PATCH] Add support for MOBI --- README.md | 4 ++-- cbconvert.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cdb5c7c..e9df713 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ It can convert comics to different formats to fit your various devices. ### Features -* reads RAR, ZIP, 7Z, CBR, CBZ, CB7, CBT, PDF, EPUB, and plain directory +* reads RAR, ZIP, 7Z, CBR, CBZ, CB7, CBT, PDF, EPUB, MOBI and plain directory * saves processed comics in CBZ (ZIP) archive format or CBT (TAR) * images can be converted to JPEG, PNG, TIFF, WEBP, AVIF, or 4-Bit BMP (16 colors) file format * rotate, flip, adjust brightness/contrast, adjust levels (Photoshop-like) or grayscale images @@ -32,7 +32,7 @@ Copy cbconvert cli binary to your PATH and create file ~/.local/share/thumbnaile [Thumbnailer Entry] TryExec=cbconvert Exec=cbconvert thumbnail --quiet --width %s --outfile %o %i -MimeType=application/pdf;application/x-cb7;application/x-cbt;application/epub+zip;application/vnd.comicbook-rar;application/vnd.comicbook+zip; +MimeType=application/pdf;application/x-cb7;application/x-cbt;application/epub+zip;application/vnd.comicbook-rar;application/vnd.comicbook+zip;application/x-mobipocket-ebook; ``` This is what it looks like in the PCManFM file manager: diff --git a/cbconvert.go b/cbconvert.go index e705f08..439833e 100644 --- a/cbconvert.go +++ b/cbconvert.go @@ -1379,7 +1379,7 @@ func (c *Convertor) isArchive(f string) bool { // isDocument checks if file is document. func (c *Convertor) isDocument(f string) bool { - var types = []string{".pdf", ".epub"} + var types = []string{".pdf", ".epub", ".mobi"} for _, t := range types { if strings.ToLower(filepath.Ext(f)) == t { return true diff --git a/go.mod b/go.mod index 0c3b35d..a736549 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/chai2010/webp v1.1.1 github.com/disintegration/imaging v1.6.2 github.com/fvbommel/sortorder v1.1.0 - github.com/gen2brain/go-fitz v1.22.2 + github.com/gen2brain/go-fitz v1.23.1 github.com/gen2brain/go-unarr v0.1.7 github.com/hotei/bmp v0.0.0-20150430041436-f620cebab0c7 github.com/strukturag/libheif v1.15.2 diff --git a/go.sum b/go.sum index 2d7150e..45af9d1 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1 github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= github.com/fvbommel/sortorder v1.1.0 h1:fUmoe+HLsBTctBDoaBwpQo5N+nrCp8g/BjKb/6ZQmYw= github.com/fvbommel/sortorder v1.1.0/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui720w+kxuqRs0= -github.com/gen2brain/go-fitz v1.22.2 h1:pisRYS3x/tvsiS4UzdBoiStmOxYoisOGNCUB4+0RKhE= -github.com/gen2brain/go-fitz v1.22.2/go.mod h1:HU04vc+RisUh/kvEd2pB0LAxmK1oyXdN4ftyshUr9rQ= +github.com/gen2brain/go-fitz v1.23.1 h1:x69/szWZXpI3jZ57mMqCg7WqqvtYnQG0lXts3L6M1Fc= +github.com/gen2brain/go-fitz v1.23.1/go.mod h1:HU04vc+RisUh/kvEd2pB0LAxmK1oyXdN4ftyshUr9rQ= github.com/gen2brain/go-unarr v0.1.7 h1:mEE7bPShJIsmAX67t6BW2ibpEUO7j5WK152KgNM9NbQ= github.com/gen2brain/go-unarr v0.1.7/go.mod h1:MK9a3hddpaIxjEtrE1f/LA5yJ7gA34cS7Oyr325sY9s= github.com/hotei/bmp v0.0.0-20150430041436-f620cebab0c7 h1:NlUATi3cllRJhpM4mfR9BxiLRXT83bcSLcOa+S8lrME=