mirror of
https://github.com/gen2brain/cbconvert
synced 2026-06-30 09:11:54 +02:00
Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 50f1edb843 | |||
| 2c5bc9e21d | |||
| d9cdf2e197 | |||
| 68e868944b | |||
| 3a84012005 | |||
| 23802d2d00 | |||
| 17e598bb3b | |||
| 2fd32c30e3 | |||
| b930b06a7d | |||
| c8d472e576 | |||
| 6701bfcfb0 | |||
| 6cea1aa441 | |||
| a05b46e6b8 | |||
| d77d2c0ce7 | |||
| bc8520d825 | |||
| 3619ed6c0d | |||
| 28ef6910e4 | |||
| 35b8bc340f | |||
| a5a45306c6 | |||
| b063367110 | |||
| 7831e487e6 | |||
| ce32d48469 | |||
| 4d1e0a44d2 | |||
| 574e364954 | |||
| 97aae5e0c7 | |||
| bbcaf0f9dd | |||
| d70de9f4db | |||
| d7be2f4d5e | |||
| 82e8a6cbac | |||
| 85818eec5f | |||
| 0c6b9fcaa8 | |||
| 55b53efcca | |||
| 4abf99a644 | |||
| ca4f13ebfe | |||
| a4c7b87dc0 | |||
| dd4c3a2dbf | |||
| 8e3f7962d1 | |||
| 1c3421028b | |||
| 5ddb4d92aa | |||
| b1e9763b0b | |||
| 14bfaf7b6e | |||
| 3dcfc1dd5e |
@@ -4,78 +4,114 @@ CBconvert
|
|||||||
Introduction
|
Introduction
|
||||||
------------
|
------------
|
||||||
|
|
||||||
CBconvert is a [Comic Book](http://en.wikipedia.org/wiki/Comic_Book_Archive_file) convert tool.
|
CBconvert is a [Comic Book](http://en.wikipedia.org/wiki/Comic_Book_Archive_file) converter written in [Go language](https://golang.org/).
|
||||||
|
|
||||||
|
It can convert one comic at a time or bulk convert comics to different formats to fit your various devices.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
|
|
||||||
- reads rar, zip, 7z, gz, bz2, cbr, cbz, cb7, cbt, pdf and plain directory
|
- reads RAR, ZIP, 7Z, GZ, BZ2, CBR, CBZ, CB7, CBT, PDF, EPUB, XPS and plain directory
|
||||||
- always saves processed comic in cbz (zip) format
|
- always saves processed comic in CBZ (ZIP) archive format
|
||||||
- images can be converted to JPEG, PNG or 4-Bit BMP (16 colors) format
|
- images can be converted to JPEG, PNG, GIF, TIFF or 4-Bit BMP (16 colors) file format
|
||||||
- choose resize algorithm (NearestNeighbor, Bilinear, Bicubic, MitchellNetravali, Lanczos2/3)
|
- rotate, flip, adjust brightness/contrast, adjust levels (Photoshop like) or grayscale images
|
||||||
|
- choose resize algorithm (NearestNeighbor, Box, Linear, MitchellNetravali, CatmullRom, Gaussian, Lanczos)
|
||||||
- export covers from comics
|
- export covers from comics
|
||||||
- create thumbnails from covers by [freedesktop](http://www.freedesktop.org/wiki/) specification
|
- create thumbnails from covers by [freedesktop](http://www.freedesktop.org/wiki/) specification
|
||||||
|
|
||||||
Download
|
Download
|
||||||
--------
|
--------
|
||||||
|
|
||||||
- [Windows static build](https://github.com/gen2brain/cbconvert/releases/download/0.1.0/cbconvert-0.1.0.zip)
|
- [Windows GUI](https://github.com/gen2brain/cbconvert/releases/download/0.5.0/cbconvert-0.5.zip)
|
||||||
- [Linux 64bit build](https://github.com/gen2brain/cbconvert/releases/download/0.1.0/cbconvert-0.1.0.tar.gz)
|
- [Windows CMD](https://github.com/gen2brain/cbconvert/releases/download/0.5.0/cbconvert-cmd-0.5.zip)
|
||||||
|
|
||||||
Compile
|
- [Linux 64bit GUI](https://github.com/gen2brain/cbconvert/releases/download/0.5.0/cbconvert-0.5.tar.gz)
|
||||||
-------
|
- [Linux 64bit CMD](https://github.com/gen2brain/cbconvert/releases/download/0.5.0/cbconvert-cmd-0.5.tar.gz)
|
||||||
|
|
||||||
Install poppler, poppler-glib, cairo and imagemagick dev packages:
|
Using cbconvert in file managers to generate freedesktop thumbnails
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
|
||||||
apt-get install libpoppler-glib-dev libcairo2-dev libmagickcore-dev libmagickwand-dev
|
Just copy cbconvert cmd binary to your PATH and create file ~/.local/share/thumbnailers/cbconvert.thumbnailer :
|
||||||
|
|
||||||
|
[Thumbnailer Entry]
|
||||||
|
TryExec=cbconvert
|
||||||
|
Exec=cbconvert thumbnail --quiet --width %s --outfile %o %i
|
||||||
|
MimeType=application/pdf;application/x-pdf;image/pdf;application/x-cbz;application/x-cbr;application/x-cb7;application/x-cbt;application/oxps;application/vnd.ms-xpsdocument;application/epub+zip;
|
||||||
|
|
||||||
Install go package:
|
This is how it looks like in PCManFM file manager:
|
||||||
|
|
||||||
go get github.com/gen2brain/cbconvert
|

|
||||||
go install github.com/gen2brain/cbconvert && cbconvert
|
|
||||||
|
|
||||||
Dependencies
|
|
||||||
------------
|
|
||||||
|
|
||||||
go get github.com/cheggaaa/go-poppler
|
Using command line app
|
||||||
go get github.com/cheggaaa/pb
|
----------------------
|
||||||
go get github.com/gen2brain/go-unarr
|
|
||||||
go get github.com/gographics/imagick/imagick
|
|
||||||
go get github.com/hotei/bmp
|
|
||||||
go get github.com/nfnt/resize
|
|
||||||
go get github.com/skarademir/naturalsort
|
|
||||||
go get github.com/ungerik/go-cairo
|
|
||||||
go get gopkg.in/alecthomas/kingpin.v2
|
|
||||||
|
|
||||||
Using
|
usage: cbconvert [<flags>] <command> [<args> ...]
|
||||||
-----
|
|
||||||
|
|
||||||
usage: cbconvert [<flags>] <args>...
|
|
||||||
|
|
||||||
Comic Book convert tool.
|
Comic Book convert tool.
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
--help Show context-sensitive help (also try --help-long and --help-man).
|
--help Show context-sensitive help (also try --help-long and --help-man).
|
||||||
--version Show application version.
|
--version Show application version.
|
||||||
-p, --png encode images to PNG instead of JPEG
|
--outdir="." Output directory
|
||||||
-b, --bmp encode images to 4-Bit BMP instead of JPEG
|
--size=0 Process only files larger then size (in MB)
|
||||||
-w, --width=0 image width
|
--recursive Process subdirectories recursively
|
||||||
-h, --height=0 image height
|
--quiet Hide console output
|
||||||
-q, --quality=75 JPEG image quality
|
|
||||||
-n, --norgb do not convert images with RGB colorspace
|
|
||||||
-i, --interpolation=1 0=NearestNeighbor, 1=Bilinear, 2=Bicubic, 3=MitchellNetravali, 4=Lanczos2, 5=Lanczos3
|
|
||||||
-s, --suffix=SUFFIX add suffix to file basename
|
|
||||||
-c, --cover extract cover
|
|
||||||
-t, --thumbnail extract cover thumbnail (freedesktop spec.)
|
|
||||||
-o, --outdir="." output directory
|
|
||||||
-m, --size=0 process only files larger then size (in MB)
|
|
||||||
-r, --recursive process subdirectories recursively
|
|
||||||
-Q, --quiet hide console output
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
<args> filename or directory
|
<args> filename or directory
|
||||||
|
|
||||||
|
Commands:
|
||||||
|
help [<command>...]
|
||||||
|
Show help.
|
||||||
|
|
||||||
|
|
||||||
|
convert [<flags>] <args>...
|
||||||
|
Convert archive or document (default command)
|
||||||
|
|
||||||
|
--width=0 Image width
|
||||||
|
--height=0 Image height
|
||||||
|
--fit Best fit for required width and height
|
||||||
|
--format="jpeg" Image format, valid values are jpeg, png, gif, tiff, bmp
|
||||||
|
--quality=75 JPEG image quality
|
||||||
|
--filter=2 0=NearestNeighbor, 1=Box, 2=Linear, 3=MitchellNetravali, 4=CatmullRom, 6=Gaussian, 7=Lanczos
|
||||||
|
--cover Convert cover image (use --no-cover if you want to exclude cover)
|
||||||
|
--rgb Convert images that have RGB colorspace (use --no-rgb if you only want to convert grayscaled images)
|
||||||
|
--nonimage Leave non image files in archive (use --no-nonimage to remove non image files from archive)
|
||||||
|
--grayscale Convert images to grayscale (monochromatic)
|
||||||
|
--rotate=0 Rotate images, valid values are 0, 90, 180, 270
|
||||||
|
--flip="none" Flip images, valid values are none, horizontal, vertical
|
||||||
|
--brightness=0 Adjust brightness of the images, must be in range (-100, 100)
|
||||||
|
--contrast=0 Adjust contrast of the images, must be in range (-100, 100)
|
||||||
|
--suffix=SUFFIX Add suffix to file basename
|
||||||
|
--levels-inmin=0 Shadow input value
|
||||||
|
--levels-inmax=255 Highlight input value
|
||||||
|
--levels-gamma=1 Midpoint/Gamma
|
||||||
|
--levels-outmin=0 Shadow output value
|
||||||
|
--levels-outmax=255 Highlight output value
|
||||||
|
|
||||||
|
cover [<flags>] <args>...
|
||||||
|
Extract cover
|
||||||
|
|
||||||
|
--width=0 Image width
|
||||||
|
--height=0 Image height
|
||||||
|
--fit Best fit for required width and height
|
||||||
|
--quality=75 JPEG image quality
|
||||||
|
--filter=2 0=NearestNeighbor, 1=Box, 2=Linear, 3=MitchellNetravali, 4=CatmullRom, 6=Gaussian, 7=Lanczos
|
||||||
|
|
||||||
|
thumbnail [<flags>] <args>...
|
||||||
|
Extract cover thumbnail (freedesktop spec.)
|
||||||
|
|
||||||
|
--width=0 Image width
|
||||||
|
--height=0 Image height
|
||||||
|
--fit Best fit for required width and height
|
||||||
|
--filter=2 0=NearestNeighbor, 1=Box, 2=Linear, 3=MitchellNetravali, 4=CatmullRom, 6=Gaussian, 7=Lanczos
|
||||||
|
|
||||||
|
[man page](https://en.wikipedia.org/wiki/Man_page) is also available:
|
||||||
|
|
||||||
|
cbconvert --help-man | man /dev/stdin
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
--------
|
--------
|
||||||
@@ -84,12 +120,65 @@ Rescale images to 1200px for all supported files found in directory with size la
|
|||||||
|
|
||||||
cbconvert --recursive --width 1200 --size 60 /media/comics/Thorgal/
|
cbconvert --recursive --width 1200 --size 60 /media/comics/Thorgal/
|
||||||
|
|
||||||
Convert all images in archive to 4bit BMP image and save result in ~/comics directory:
|
Convert all images in pdf to 4bit BMP image and save result in ~/comics directory:
|
||||||
|
|
||||||
cbconvert --bmp --outdir ~/comics /media/comics/Garfield/Garfield_01.cbz
|
cbconvert --bmp --outdir ~/comics /media/comics/Garfield/Garfield_01.pdf
|
||||||
|
|
||||||
[BMP](http://en.wikipedia.org/wiki/BMP_file_format) format is uncompressed, for black&white pages very good choice. Archive size can be smaller 2-3x and file will be readable by comic readers.
|
[BMP](http://en.wikipedia.org/wiki/BMP_file_format) format is very good choice for black&white pages. Archive size can be smaller 2-3x and file will be readable by comic readers.
|
||||||
|
|
||||||
Generate thumbnails by freedesktop specification in ~/.thumbnails/normal directory, Lanczos3 algorithm is used for resizing:
|
Generate thumbnails by [freedesktop specification](http://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html) in ~/.thumbnails/normal directory with width 512:
|
||||||
|
|
||||||
cbconvert --interpolation=5 --outdir ~/.thumbnails/normal --thumbnail /media/comics/GrooTheWanderer/
|
cbconvert thumbnail --width 512 --outdir ~/.thumbnails/normal /media/comics/GrooTheWanderer/
|
||||||
|
|
||||||
|
Extract covers to ~/covers dir for all supported files found in directory, Lanczos algorithm is used for resizing:
|
||||||
|
|
||||||
|
cbconvert cover --outdir ~/covers --filter=7 /media/comics/GrooTheWanderer/
|
||||||
|
|
||||||
|
Compile
|
||||||
|
-------
|
||||||
|
|
||||||
|
Install imagemagick dev packages:
|
||||||
|
|
||||||
|
apt-get install libmagickcore-dev libmagickwand-dev
|
||||||
|
|
||||||
|
Compile latest MuPDF:
|
||||||
|
|
||||||
|
git clone git://git.ghostscript.com/mupdf.git && cd mupdf
|
||||||
|
git submodule update --init --recursive
|
||||||
|
curl -L https://gist.githubusercontent.com/gen2brain/7869ac4c6db5933f670f/raw/1619394dc957ae10bcd73c713760993466b4bfea/mupdf-openssl-curl.patch | patch -p1
|
||||||
|
sed -e "1iHAVE_X11 = no" -e "1iWANT_OPENSSL = no" -e "1iWANT_CURL = no" -i Makerules
|
||||||
|
HAVE_X11=no HAVE_GLFW=no HAVE_GLUT=no WANT_OPENSSL=no WANT_CURL=no HAVE_MUJS=yes HAVE_JSCORE=no HAVE_V8=no make && make install
|
||||||
|
|
||||||
|
Compile unarr library:
|
||||||
|
|
||||||
|
git clone https://github.com/zeniko/unarr && cd unarr
|
||||||
|
mkdir lzma920 && cd lzma920 && curl -L http://www.7-zip.org/a/lzma920.tar.bz2 | tar -xjvp && cd ..
|
||||||
|
curl -L http://zlib.net/zlib-1.2.8.tar.gz | tar -xzvp
|
||||||
|
curl -L http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz | tar -xzvp
|
||||||
|
curl -L https://gist.githubusercontent.com/gen2brain/89fe506863be3fb139e8/raw/8783a7d81e22ad84944d146c5e33beab6dffc641/unarr-makefile.patch | patch -p1
|
||||||
|
CFLAGS="-DHAVE_7Z -DHAVE_ZLIB -DHAVE_BZIP2 -I./lzma920/C -I./zlib-1.2.8 -I./bzip2-1.0.6" make
|
||||||
|
cp build/debug/libunarr.a /usr/lib64/ && cp unarr.h /usr/include
|
||||||
|
|
||||||
|
Install dependencies:
|
||||||
|
|
||||||
|
go get github.com/cheggaaa/pb
|
||||||
|
go get github.com/disintegration/imaging
|
||||||
|
go get github.com/gen2brain/go-fitz
|
||||||
|
go get github.com/gen2brain/go-unarr
|
||||||
|
go get github.com/gographics/imagick/imagick
|
||||||
|
go get github.com/hotei/bmp
|
||||||
|
go get github.com/skarademir/naturalsort
|
||||||
|
go get golang.org/x/image/tiff
|
||||||
|
go get golang.org/x/image/webp
|
||||||
|
go get gopkg.in/alecthomas/kingpin.v2
|
||||||
|
|
||||||
|
For command line app:
|
||||||
|
|
||||||
|
go get github.com/gen2brain/cbconvert
|
||||||
|
go build -o $GOPATH/bin/cbconvert github.com/gen2brain/cbconvert/cmd
|
||||||
|
|
||||||
|
For GUI app:
|
||||||
|
|
||||||
|
go get gopkg.in/qml.v1
|
||||||
|
go get github.com/gen2brain/cbconvert
|
||||||
|
go build -o $GOPATH/bin/cbconvert github.com/gen2brain/cbconvert/gui
|
||||||
|
|||||||
+529
-313
File diff suppressed because it is too large
Load Diff
+149
@@ -0,0 +1,149 @@
|
|||||||
|
// Author: Milan Nikolic <gen2brain@gmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
//go:generate goversioninfo
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"image/jpeg"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
|
"strconv"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/cheggaaa/pb"
|
||||||
|
"github.com/gen2brain/cbconvert"
|
||||||
|
"gopkg.in/alecthomas/kingpin.v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Parses command line flags
|
||||||
|
func parseFlags() (cbconvert.Options, []string) {
|
||||||
|
opts := cbconvert.Options{}
|
||||||
|
var args []string
|
||||||
|
|
||||||
|
kingpin.Version("CBconvert 0.5.0")
|
||||||
|
kingpin.CommandLine.Help = "Comic Book convert tool."
|
||||||
|
kingpin.UsageTemplate(kingpin.CompactUsageTemplate)
|
||||||
|
|
||||||
|
kingpin.Flag("outdir", "Output directory").Default(".").StringVar(&opts.Outdir)
|
||||||
|
kingpin.Flag("size", "Process only files larger then size (in MB)").Default(strconv.Itoa(0)).Int64Var(&opts.Size)
|
||||||
|
kingpin.Flag("recursive", "Process subdirectories recursively").BoolVar(&opts.Recursive)
|
||||||
|
kingpin.Flag("quiet", "Hide console output").BoolVar(&opts.Quiet)
|
||||||
|
|
||||||
|
convert := kingpin.Command("convert", "Convert archive or document (default command)").Default()
|
||||||
|
convert.Arg("args", "filename or directory").Required().ExistingFilesOrDirsVar(&args)
|
||||||
|
convert.Flag("width", "Image width").Default(strconv.Itoa(0)).IntVar(&opts.Width)
|
||||||
|
convert.Flag("height", "Image height").Default(strconv.Itoa(0)).IntVar(&opts.Height)
|
||||||
|
convert.Flag("fit", "Best fit for required width and height").BoolVar(&opts.Fit)
|
||||||
|
convert.Flag("format", "Image format, valid values are jpeg, png, gif, tiff, bmp").Default("jpeg").StringVar(&opts.Format)
|
||||||
|
convert.Flag("quality", "JPEG image quality").Default(strconv.Itoa(jpeg.DefaultQuality)).IntVar(&opts.Quality)
|
||||||
|
convert.Flag("filter", "0=NearestNeighbor, 1=Box, 2=Linear, 3=MitchellNetravali, 4=CatmullRom, 6=Gaussian, 7=Lanczos").Default(strconv.Itoa(cbconvert.Linear)).IntVar(&opts.Filter)
|
||||||
|
convert.Flag("cover", "Convert cover image (use --no-cover if you want to exclude cover)").Default("true").BoolVar(&opts.ConvertCover)
|
||||||
|
convert.Flag("rgb", "Convert images that have RGB colorspace (use --no-rgb if you only want to convert grayscaled images)").Default("true").BoolVar(&opts.RGB)
|
||||||
|
convert.Flag("nonimage", "Leave non image files in archive (use --no-nonimage to remove non image files from archive)").Default("true").BoolVar(&opts.NonImage)
|
||||||
|
convert.Flag("grayscale", "Convert images to grayscale (monochromatic)").BoolVar(&opts.Grayscale)
|
||||||
|
convert.Flag("rotate", "Rotate images, valid values are 0, 90, 180, 270").Default(strconv.Itoa(0)).IntVar(&opts.Rotate)
|
||||||
|
convert.Flag("flip", "Flip images, valid values are none, horizontal, vertical").Default("none").StringVar(&opts.Flip)
|
||||||
|
convert.Flag("brightness", "Adjust brightness of the images, must be in range (-100, 100)").Default(strconv.Itoa(0)).Float64Var(&opts.Brightness)
|
||||||
|
convert.Flag("contrast", "Adjust contrast of the images, must be in range (-100, 100)").Default(strconv.Itoa(0)).Float64Var(&opts.Contrast)
|
||||||
|
convert.Flag("suffix", "Add suffix to file basename").StringVar(&opts.Suffix)
|
||||||
|
convert.Flag("levels-inmin", "Shadow input value").Default(strconv.Itoa(0)).Float64Var(&opts.LevelsInMin)
|
||||||
|
convert.Flag("levels-gamma", "Midpoint/Gamma").Default(strconv.Itoa(1.00)).Float64Var(&opts.LevelsGamma)
|
||||||
|
convert.Flag("levels-inmax", "Highlight input value").Default(strconv.Itoa(255)).Float64Var(&opts.LevelsInMax)
|
||||||
|
convert.Flag("levels-outmin", "Shadow output value").Default(strconv.Itoa(0)).Float64Var(&opts.LevelsOutMin)
|
||||||
|
convert.Flag("levels-outmax", "Highlight output value").Default(strconv.Itoa(255)).Float64Var(&opts.LevelsOutMax)
|
||||||
|
|
||||||
|
cover := kingpin.Command("cover", "Extract cover")
|
||||||
|
cover.Arg("args", "filename or directory").Required().ExistingFilesOrDirsVar(&args)
|
||||||
|
cover.Flag("width", "Image width").Default(strconv.Itoa(0)).IntVar(&opts.Width)
|
||||||
|
cover.Flag("height", "Image height").Default(strconv.Itoa(0)).IntVar(&opts.Height)
|
||||||
|
cover.Flag("fit", "Best fit for required width and height").BoolVar(&opts.Fit)
|
||||||
|
cover.Flag("quality", "JPEG image quality").Default(strconv.Itoa(jpeg.DefaultQuality)).IntVar(&opts.Quality)
|
||||||
|
cover.Flag("filter", "0=NearestNeighbor, 1=Box, 2=Linear, 3=MitchellNetravali, 4=CatmullRom, 6=Gaussian, 7=Lanczos").Default(strconv.Itoa(cbconvert.Linear)).IntVar(&opts.Filter)
|
||||||
|
|
||||||
|
thumbnail := kingpin.Command("thumbnail", "Extract cover thumbnail (freedesktop spec.)")
|
||||||
|
thumbnail.Arg("args", "filename or directory").Required().ExistingFilesOrDirsVar(&args)
|
||||||
|
thumbnail.Flag("outfile", "Output file").Default("").StringVar(&opts.Outfile)
|
||||||
|
thumbnail.Flag("width", "Image width").Default(strconv.Itoa(0)).IntVar(&opts.Width)
|
||||||
|
thumbnail.Flag("height", "Image height").Default(strconv.Itoa(0)).IntVar(&opts.Height)
|
||||||
|
thumbnail.Flag("fit", "Best fit for required width and height").BoolVar(&opts.Fit)
|
||||||
|
thumbnail.Flag("filter", "0=NearestNeighbor, 1=Box, 2=Linear, 3=MitchellNetravali, 4=CatmullRom, 6=Gaussian, 7=Lanczos").Default(strconv.Itoa(cbconvert.Linear)).IntVar(&opts.Filter)
|
||||||
|
|
||||||
|
switch kingpin.Parse() {
|
||||||
|
case "cover":
|
||||||
|
opts.Cover = true
|
||||||
|
case "thumbnail":
|
||||||
|
opts.Thumbnail = true
|
||||||
|
}
|
||||||
|
|
||||||
|
return opts, args
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
opts, args := parseFlags()
|
||||||
|
conv := cbconvert.NewConvertor(opts)
|
||||||
|
|
||||||
|
var bar *pb.ProgressBar
|
||||||
|
|
||||||
|
c := make(chan os.Signal, 3)
|
||||||
|
signal.Notify(c, os.Interrupt, syscall.SIGHUP, syscall.SIGTERM)
|
||||||
|
go func() {
|
||||||
|
for _ = range c {
|
||||||
|
fmt.Fprintf(os.Stderr, "Aborting\n")
|
||||||
|
os.RemoveAll(conv.Workdir)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
if _, err := os.Stat(opts.Outdir); err != nil {
|
||||||
|
os.MkdirAll(opts.Outdir, 0777)
|
||||||
|
}
|
||||||
|
|
||||||
|
files := conv.GetFiles(args)
|
||||||
|
|
||||||
|
if opts.Cover || opts.Thumbnail {
|
||||||
|
if !opts.Quiet {
|
||||||
|
bar = pb.New(conv.Nfiles)
|
||||||
|
bar.ShowTimeLeft = false
|
||||||
|
bar.Start()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, file := range files {
|
||||||
|
stat, err := os.Stat(file)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error Stat: %v\n", err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if opts.Cover {
|
||||||
|
conv.ExtractCover(file, stat)
|
||||||
|
if !opts.Quiet {
|
||||||
|
bar.Increment()
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
} else if opts.Thumbnail {
|
||||||
|
conv.ExtractThumbnail(file, stat)
|
||||||
|
if !opts.Quiet {
|
||||||
|
bar.Increment()
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
conv.ConvertComic(file, stat)
|
||||||
|
}
|
||||||
|
}
|
||||||
Executable
+28
@@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
CHROOT="/home/milann/chroot"
|
||||||
|
MINGW="/usr/i686-w64-mingw32"
|
||||||
|
|
||||||
|
mkdir -p build
|
||||||
|
rm -f resource.syso
|
||||||
|
|
||||||
|
LIBRARY_PATH="$CHROOT/usr/lib:$CHROOT/lib" \
|
||||||
|
PKG_CONFIG_PATH="$CHROOT/usr/lib/pkgconfig" \
|
||||||
|
PKG_CONFIG_LIBDIR="$CHROOT/usr/lib/pkgconfig" \
|
||||||
|
CGO_LDFLAGS="-L$CHROOT/usr/lib -L$CHROOT/lib" \
|
||||||
|
CC_FOR_TARGET="x86_64-pc-linux-gnu-gcc" CXX_FOR_TARGET="x86_64-pc-linux-gnu-g++" \
|
||||||
|
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -v -x -o build/cbconvert
|
||||||
|
strip build/cbconvert
|
||||||
|
|
||||||
|
go generate
|
||||||
|
PKG_CONFIG="/usr/bin/i686-w64-mingw32-pkg-config" \
|
||||||
|
PKG_CONFIG_PATH="$MINGW/usr/lib/pkgconfig" \
|
||||||
|
PKG_CONFIG_LIBDIR="$MINGW/usr/lib/pkgconfig" \
|
||||||
|
CGO_LDFLAGS="-L$MINGW/usr/lib" \
|
||||||
|
CGO_CFLAGS="-I$MINGW/usr/include -Wno-poison-system-directories" \
|
||||||
|
CGO_CXXFLAGS="-I$MINGW/usr/include -Wno-poison-system-directories" \
|
||||||
|
CGO_CPPFLAGS="-I$MINGW/usr/include -Wno-poison-system-directories" \
|
||||||
|
CC="i686-w64-mingw32-gcc" CXX="i686-w64-mingw32-g++" \
|
||||||
|
CC_FOR_TARGET="i686-w64-mingw32-gcc" CXX_FOR_TARGET="i686-w64-mingw32-g++" \
|
||||||
|
CGO_ENABLED=1 GOOS=windows GOARCH=386 go build -v -x -o build/cbconvert.exe -ldflags "-linkmode external '-extldflags=-static -Wl,--allow-multiple-definition'"
|
||||||
|
i686-w64-mingw32-strip build/cbconvert.exe
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"FixedFileInfo":
|
||||||
|
{
|
||||||
|
"FileVersion": {
|
||||||
|
"Major": 0,
|
||||||
|
"Minor": 6,
|
||||||
|
"Patch": 0,
|
||||||
|
"Build": 0
|
||||||
|
},
|
||||||
|
"ProductVersion": {
|
||||||
|
"Major": 0,
|
||||||
|
"Minor": 6,
|
||||||
|
"Patch": 0,
|
||||||
|
"Build": 0
|
||||||
|
},
|
||||||
|
"FileFlagsMask": "3f",
|
||||||
|
"FileFlags ": "00",
|
||||||
|
"FileOS": "040004",
|
||||||
|
"FileType": "01",
|
||||||
|
"FileSubType": "00"
|
||||||
|
},
|
||||||
|
"StringFileInfo":
|
||||||
|
{
|
||||||
|
"Comments": "Comic Book converter",
|
||||||
|
"CompanyName": "",
|
||||||
|
"FileDescription": "CBconvert CLI",
|
||||||
|
"FileVersion": "0.6.0",
|
||||||
|
"InternalName": "",
|
||||||
|
"LegalCopyright": "",
|
||||||
|
"LegalTrademarks": "",
|
||||||
|
"OriginalFilename": "cbconvert.exe",
|
||||||
|
"PrivateBuild": "",
|
||||||
|
"ProductName": "CBconvert",
|
||||||
|
"ProductVersion": "0.6.0",
|
||||||
|
"SpecialBuild": ""
|
||||||
|
},
|
||||||
|
"VarFileInfo":
|
||||||
|
{
|
||||||
|
"Translation": {
|
||||||
|
"LangID": "0409",
|
||||||
|
"CharsetID": "04B0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
@@ -0,0 +1,965 @@
|
|||||||
|
import QtQuick 2.5
|
||||||
|
import QtQuick.Controls 1.4
|
||||||
|
import QtQuick.Dialogs 1.2
|
||||||
|
import QtQuick.Layouts 1.2
|
||||||
|
import QtQuick.Window 2.2
|
||||||
|
import Qt.labs.settings 1.0
|
||||||
|
|
||||||
|
ApplicationWindow {
|
||||||
|
id: applicationWindow
|
||||||
|
visible: true
|
||||||
|
width: 800
|
||||||
|
height: 600
|
||||||
|
title: "CBconvert"
|
||||||
|
|
||||||
|
property int margin: 15
|
||||||
|
property int screenWidth: Screen.width
|
||||||
|
property int screenHeight: Screen.height
|
||||||
|
|
||||||
|
function updateImage() {
|
||||||
|
imagePreview.source = ""
|
||||||
|
sizePreview.text = ""
|
||||||
|
if(groupBoxPreview.checked) {
|
||||||
|
if(c.len > 0) {
|
||||||
|
imagePreview.source = "image://cover/" + c.get(listView.currentIndex).path
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: splitView1
|
||||||
|
anchors.rightMargin: margin
|
||||||
|
anchors.leftMargin: margin
|
||||||
|
anchors.bottomMargin: margin
|
||||||
|
anchors.topMargin: margin
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: rowLayout1
|
||||||
|
anchors.bottom: rowLayout2.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottomMargin: 15
|
||||||
|
Layout.minimumHeight: 250
|
||||||
|
|
||||||
|
ScrollView {
|
||||||
|
id: scrollview
|
||||||
|
anchors.right: columnButtons.left
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.rightMargin: margin
|
||||||
|
frameVisible: true
|
||||||
|
highlightOnFocus: false
|
||||||
|
verticalScrollBarPolicy: 2
|
||||||
|
flickableItem.interactive: true
|
||||||
|
focus: true
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: listView
|
||||||
|
anchors.topMargin: 0
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: 1
|
||||||
|
focus: true
|
||||||
|
|
||||||
|
model: c.len
|
||||||
|
|
||||||
|
header: Rectangle {
|
||||||
|
height: 20
|
||||||
|
width: ListView.view.width
|
||||||
|
color: "#DCDCDC"
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: nameHeader
|
||||||
|
text: 'Name'
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 5
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
c.byName()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: typeHeader
|
||||||
|
text: 'Type'
|
||||||
|
width: 40
|
||||||
|
anchors.right: sizeHeader.left
|
||||||
|
anchors.rightMargin: 40
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
c.byType()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: sizeHeader
|
||||||
|
text: 'Size'
|
||||||
|
width: 40
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 15
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
c.bySize()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delegate: Item {
|
||||||
|
id: item1
|
||||||
|
width: ListView.view.width
|
||||||
|
height: 20
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: nameItem
|
||||||
|
text: c.get(index).name
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 5
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: parent.width - 170
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: typeItem
|
||||||
|
width: 40
|
||||||
|
text: c.get(index).type
|
||||||
|
anchors.right: sizeItem.left
|
||||||
|
anchors.rightMargin: 40
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: sizeItem
|
||||||
|
width: 40
|
||||||
|
text: c.get(index).sizeHuman
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 15
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
listView.currentIndex = index
|
||||||
|
listView.forceActiveFocus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
highlight: Rectangle {
|
||||||
|
width: ListView.view ? ListView.view.width : undefined
|
||||||
|
color: "#326686"
|
||||||
|
opacity: 0.2
|
||||||
|
y: listView.currentItem.y
|
||||||
|
Behavior on y {
|
||||||
|
SpringAnimation {
|
||||||
|
spring: 3
|
||||||
|
damping: 0.2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onCurrentItemChanged: updateImage()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: columnButtons
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.bottomMargin: 0
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: 0
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: columnButtonsFiles
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: 0
|
||||||
|
spacing: 5
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: buttonAddFile
|
||||||
|
objectName: "buttonAddFile"
|
||||||
|
text: "Add &Files"
|
||||||
|
onClicked: {
|
||||||
|
fileDialogFile.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: buttonAddDir
|
||||||
|
objectName: "buttonAddDir"
|
||||||
|
text: "Add &Dir"
|
||||||
|
onClicked: {
|
||||||
|
fileDialogDir.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: buttonRemove
|
||||||
|
objectName: "buttonRemove"
|
||||||
|
text: "Remove"
|
||||||
|
enabled: (c.len !== 0) ? true : false
|
||||||
|
onClicked: {
|
||||||
|
c.remove(listView.currentIndex)
|
||||||
|
updateImage()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: buttonRemoveAll
|
||||||
|
objectName: "buttonRemoveAll"
|
||||||
|
text: "Remove All"
|
||||||
|
enabled: (c.len !== 0) ? true : false
|
||||||
|
onClicked: {
|
||||||
|
c.removeAll()
|
||||||
|
updateImage()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: columnButtonsActions
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.bottomMargin: 0
|
||||||
|
spacing: 5
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: buttonThumbnail
|
||||||
|
objectName: "buttonThumbnail"
|
||||||
|
text: "Thumbnail"
|
||||||
|
anchors.bottom: buttonCover.top
|
||||||
|
anchors.bottomMargin: 5
|
||||||
|
tooltip: "Extract Thumbnail (freedesktop spec.)"
|
||||||
|
enabled: (textFieldOutDir.text != "" && c.len !== 0) ? true : false
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: buttonCover
|
||||||
|
objectName: "buttonCover"
|
||||||
|
text: "Cover"
|
||||||
|
anchors.bottom: buttonConvert.top
|
||||||
|
anchors.bottomMargin: 15
|
||||||
|
tooltip: "Extract Cover"
|
||||||
|
enabled: (textFieldOutDir.text != "" && c.len !== 0) ? true : false
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: buttonConvert
|
||||||
|
objectName: "buttonConvert"
|
||||||
|
text: "&Convert"
|
||||||
|
tooltip: "Convert archives and documents"
|
||||||
|
enabled: (textFieldOutDir.text != "" && c.len !== 0) ? true : false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: rowLayout2
|
||||||
|
spacing: 0
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: columnLeft
|
||||||
|
anchors.right: columnMiddle.left
|
||||||
|
anchors.rightMargin: margin
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.bottomMargin: 0
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: 0
|
||||||
|
Layout.minimumWidth: 200
|
||||||
|
|
||||||
|
GroupBox {
|
||||||
|
id: groupBoxPreview
|
||||||
|
checkable: true
|
||||||
|
flat: true
|
||||||
|
anchors.fill: parent
|
||||||
|
title: "Preview"
|
||||||
|
|
||||||
|
Image {
|
||||||
|
id: imagePreview
|
||||||
|
anchors.fill: parent
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
asynchronous: true
|
||||||
|
cache: false
|
||||||
|
}
|
||||||
|
|
||||||
|
BusyIndicator {
|
||||||
|
running: imagePreview.status === Image.Loading
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
onCheckedChanged: updateImage()
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: sizePreview
|
||||||
|
objectName: "sizePreview"
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.top: groupBoxPreview.bottom
|
||||||
|
anchors.topMargin: -5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: columnMiddle
|
||||||
|
anchors.right: columnRight.left
|
||||||
|
anchors.rightMargin: margin
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: 0
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.bottomMargin: 0
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
GroupBox {
|
||||||
|
id: groupBoxInput
|
||||||
|
flat: true
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
title: "Input"
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: 0
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: columnInput
|
||||||
|
anchors.bottomMargin: 0
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: 5
|
||||||
|
|
||||||
|
CheckBox {
|
||||||
|
id: checkBoxRecursive
|
||||||
|
objectName: "checkBoxRecursive"
|
||||||
|
text: "Recurse SubDirectories"
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckBox {
|
||||||
|
id: checkBoxNoRGB
|
||||||
|
objectName: "checkBoxNoRGB"
|
||||||
|
text: "Only Grayscaled Images"
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckBox {
|
||||||
|
id: checkBoxConvertCover
|
||||||
|
objectName: "checkBoxConvertCover"
|
||||||
|
text: "Exclude Cover"
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.bottomMargin: 0
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
spacing: 5
|
||||||
|
|
||||||
|
SpinBox {
|
||||||
|
id: spinboxSize
|
||||||
|
objectName: "spinboxSize"
|
||||||
|
stepSize: 10
|
||||||
|
prefix: ""
|
||||||
|
maximumValue: 1000
|
||||||
|
suffix: " MiB"
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Minimum Size"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupBox {
|
||||||
|
id: groupBoxTransform
|
||||||
|
flat: true
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.bottomMargin: 0
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
title: "Transform"
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: columnTransform
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: 5
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: buttonLevels
|
||||||
|
text: "Levels..."
|
||||||
|
enabled: (c.len > 0) ? true : false
|
||||||
|
onClicked: {
|
||||||
|
levelsDialog.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Brightness: " + sliderBrightness.value
|
||||||
|
}
|
||||||
|
|
||||||
|
Slider {
|
||||||
|
id: sliderBrightness
|
||||||
|
objectName: "sliderBrightness"
|
||||||
|
value: 0
|
||||||
|
stepSize: 1
|
||||||
|
minimumValue: -100
|
||||||
|
maximumValue: 100
|
||||||
|
activeFocusOnPress: true
|
||||||
|
updateValueWhileDragging: false
|
||||||
|
enabled: (c.len > 0) ? true : false
|
||||||
|
onValueChanged: updateImage()
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Contrast: " + sliderContrast.value
|
||||||
|
}
|
||||||
|
|
||||||
|
Slider {
|
||||||
|
id: sliderContrast
|
||||||
|
objectName: "sliderContrast"
|
||||||
|
value: 0
|
||||||
|
maximumValue: 100
|
||||||
|
stepSize: 1
|
||||||
|
minimumValue: -100
|
||||||
|
activeFocusOnPress: true
|
||||||
|
updateValueWhileDragging: false
|
||||||
|
enabled: (c.len > 0) ? true : false
|
||||||
|
onValueChanged: updateImage()
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Flip:"
|
||||||
|
}
|
||||||
|
|
||||||
|
ComboBox {
|
||||||
|
id: comboBoxFlip
|
||||||
|
objectName: "comboBoxFlip"
|
||||||
|
enabled: (c.len > 0) ? true : false
|
||||||
|
|
||||||
|
model: ListModel {
|
||||||
|
ListElement {
|
||||||
|
text: "None"
|
||||||
|
}
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
text: "Horizontal"
|
||||||
|
}
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
text: "Vertical"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onActivated: updateImage()
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Rotate:"
|
||||||
|
}
|
||||||
|
|
||||||
|
ComboBox {
|
||||||
|
id: comboBoxRotate
|
||||||
|
objectName: "comboBoxRotate"
|
||||||
|
enabled: (c.len > 0) ? true : false
|
||||||
|
|
||||||
|
model: ListModel {
|
||||||
|
ListElement {
|
||||||
|
text: "0"
|
||||||
|
}
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
text: "90"
|
||||||
|
}
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
text: "180"
|
||||||
|
}
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
text: "270"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onActivated: updateImage()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: columnRight
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: 0
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.bottomMargin: 0
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
GroupBox {
|
||||||
|
id: groupBoxOutput
|
||||||
|
flat: true
|
||||||
|
title: "Output"
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: 0
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: columnOutput
|
||||||
|
anchors.bottomMargin: 0
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: 5
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: rowLayoutOutput
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: 0
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
spacing: 5
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: textFieldOutDir
|
||||||
|
objectName: "textFieldOutDir"
|
||||||
|
anchors.right: buttonBrowse.left
|
||||||
|
anchors.rightMargin: 5
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
placeholderText: "Output Directory"
|
||||||
|
|
||||||
|
Settings {
|
||||||
|
id: settingsOutDir
|
||||||
|
property alias text: textFieldOutDir.text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: buttonBrowse
|
||||||
|
text: "..."
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
onClicked: {
|
||||||
|
fileDialogOutput.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: textFieldSuffix
|
||||||
|
objectName: "textFieldSuffix"
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
placeholderText: "Add Suffix to Output File"
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckBox {
|
||||||
|
id: checkBoxNonImage
|
||||||
|
objectName: "checkBoxNonImage"
|
||||||
|
text: "Remove Non-Image Files"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GroupBox {
|
||||||
|
id: groupBoxImage
|
||||||
|
flat: true
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
title: "Image"
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.bottomMargin: 0
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: columnFormat
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: 5
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Format:"
|
||||||
|
}
|
||||||
|
|
||||||
|
ComboBox {
|
||||||
|
id: comboBoxFormat
|
||||||
|
objectName: "comboBoxFormat"
|
||||||
|
enabled: (c.len > 0) ? true : false
|
||||||
|
|
||||||
|
model: ListModel {
|
||||||
|
ListElement {
|
||||||
|
text: "JPEG"
|
||||||
|
}
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
text: "PNG"
|
||||||
|
}
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
text: "GIF"
|
||||||
|
}
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
text: "BMP"
|
||||||
|
}
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
text: "TIFF"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onActivated: updateImage()
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Size:"
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
spacing: 5
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: width
|
||||||
|
objectName: "width"
|
||||||
|
placeholderText: "width"
|
||||||
|
maximumLength: 4
|
||||||
|
implicitWidth: 50
|
||||||
|
onAccepted: updateImage()
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: x
|
||||||
|
text: "x"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: height
|
||||||
|
objectName: "height"
|
||||||
|
placeholderText: "height"
|
||||||
|
maximumLength: 4
|
||||||
|
implicitWidth: 50
|
||||||
|
onAccepted: updateImage()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckBox {
|
||||||
|
id: checkBoxFit
|
||||||
|
objectName: "checkBoxFit"
|
||||||
|
text: "Best Fit"
|
||||||
|
enabled: (c.len > 0) ? true : false
|
||||||
|
onClicked: updateImage()
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Resize Algorithm:"
|
||||||
|
}
|
||||||
|
|
||||||
|
ComboBox {
|
||||||
|
id: comboBoxFilter
|
||||||
|
objectName: "comboBoxFilter"
|
||||||
|
currentIndex: 2
|
||||||
|
enabled: (c.len > 0) ? true : false
|
||||||
|
|
||||||
|
model: ListModel {
|
||||||
|
ListElement {
|
||||||
|
text: "NearestNeighbor"
|
||||||
|
}
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
text: "Box"
|
||||||
|
}
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
text: "Linear"
|
||||||
|
}
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
text: "MitchellNetravali"
|
||||||
|
}
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
text: "CatmullRom"
|
||||||
|
}
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
text: "Gaussian"
|
||||||
|
}
|
||||||
|
|
||||||
|
ListElement {
|
||||||
|
text: "Lanczos"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onActivated: updateImage()
|
||||||
|
|
||||||
|
Settings {
|
||||||
|
id: settingsFilter
|
||||||
|
property alias currentIndex: comboBoxFilter.currentIndex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Quality: " + sliderQuality.value
|
||||||
|
}
|
||||||
|
|
||||||
|
Slider {
|
||||||
|
id: sliderQuality
|
||||||
|
objectName: "sliderQuality"
|
||||||
|
stepSize: 1
|
||||||
|
value: 75
|
||||||
|
maximumValue: 100
|
||||||
|
activeFocusOnPress: true
|
||||||
|
updateValueWhileDragging: false
|
||||||
|
enabled: (c.len > 0 && comboBoxFormat.currentText == "JPEG") ? true : false
|
||||||
|
onValueChanged: updateImage()
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckBox {
|
||||||
|
id: checkBoxGrayscale
|
||||||
|
objectName: "checkBoxGrayscale"
|
||||||
|
text: "Convert to Grayscale"
|
||||||
|
enabled: (c.len > 0) ? true : false
|
||||||
|
onClicked: updateImage()
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings {
|
||||||
|
id: settingsQuality
|
||||||
|
property alias value: sliderQuality.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FileDialog {
|
||||||
|
id: fileDialogFile
|
||||||
|
modality: Qt.WindowModal
|
||||||
|
title: "Add Files"
|
||||||
|
selectFolder: false
|
||||||
|
selectMultiple: true
|
||||||
|
selectExisting: true
|
||||||
|
sidebarVisible: true
|
||||||
|
nameFilters: [ "Comic files (*.rar *.zip *.7z *.gz *.bz2 *.cbr *.cbz *.cb7 *.cbt *.pdf *.epub *.xps)" ]
|
||||||
|
onAccepted: {
|
||||||
|
c.addUrls(decodeURIComponent(fileUrls.join("_CBSEP_")))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FileDialog {
|
||||||
|
id: fileDialogDir
|
||||||
|
modality: Qt.WindowModal
|
||||||
|
title: "Add Directory"
|
||||||
|
selectFolder: true
|
||||||
|
sidebarVisible: true
|
||||||
|
onAccepted: {
|
||||||
|
c.addUrls(decodeURIComponent(fileUrl.toString()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FileDialog {
|
||||||
|
id: fileDialogOutput
|
||||||
|
modality: Qt.WindowModal
|
||||||
|
title: "Output Directory"
|
||||||
|
selectFolder: true
|
||||||
|
sidebarVisible: true
|
||||||
|
onAccepted: {
|
||||||
|
textFieldOutDir.text = decodeURIComponent(fileUrl.toString().replace("file://", ""))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
id: levelsDialog
|
||||||
|
objectName: "levelsDialog"
|
||||||
|
title: "Levels"
|
||||||
|
standardButtons: StandardButton.Close
|
||||||
|
width: 230
|
||||||
|
height: 150
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Input Levels:"
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
spacing: 5
|
||||||
|
|
||||||
|
SpinBox {
|
||||||
|
id: spinboxLevelsInMin
|
||||||
|
objectName: "spinboxLevelsInMin"
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
stepSize: 1
|
||||||
|
maximumValue: 255
|
||||||
|
value: 0
|
||||||
|
onEditingFinished: updateImage()
|
||||||
|
Keys.onReturnPressed: {
|
||||||
|
event.accepted = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SpinBox {
|
||||||
|
id: spinboxLevelsGamma
|
||||||
|
objectName: "spinboxLevelsGamma"
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
decimals: 2
|
||||||
|
stepSize: 0.01
|
||||||
|
maximumValue: 10.00
|
||||||
|
value: 1.00
|
||||||
|
onEditingFinished: updateImage()
|
||||||
|
}
|
||||||
|
|
||||||
|
SpinBox {
|
||||||
|
id: spinboxLevelsInMax
|
||||||
|
objectName: "spinboxLevelsInMax"
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
stepSize: 1
|
||||||
|
maximumValue: 255
|
||||||
|
value: 255
|
||||||
|
onEditingFinished: updateImage()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Output Levels:"
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
spacing: 5
|
||||||
|
|
||||||
|
SpinBox {
|
||||||
|
id: spinboxLevelsOutMin
|
||||||
|
objectName: "spinboxLevelsOutMin"
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
stepSize: 1
|
||||||
|
maximumValue: 255
|
||||||
|
value: 0
|
||||||
|
onEditingFinished: updateImage()
|
||||||
|
}
|
||||||
|
|
||||||
|
SpinBox {
|
||||||
|
id: spinboxLevelsOutMax
|
||||||
|
objectName: "spinboxLevelsOutMax"
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
stepSize: 1
|
||||||
|
maximumValue: 255
|
||||||
|
value: 255
|
||||||
|
onEditingFinished: updateImage()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
statusBar: StatusBar {
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: labelStatus
|
||||||
|
objectName: "labelStatus"
|
||||||
|
text: "Ready"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: rectangle1
|
||||||
|
Layout.fillWidth: true
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: labelPercent
|
||||||
|
objectName: "labelPercent"
|
||||||
|
font.pointSize: 9
|
||||||
|
anchors.right: progressBar.left
|
||||||
|
anchors.rightMargin: 5
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
ProgressBar {
|
||||||
|
id: progressBar
|
||||||
|
objectName: "progressBar"
|
||||||
|
visible: false
|
||||||
|
value: 0.0
|
||||||
|
minimumValue : 0.0
|
||||||
|
maximumValue : 100.0
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.bottomMargin: -10
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: -10
|
||||||
|
anchors.right: labelProgress.left
|
||||||
|
anchors.rightMargin: 5
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
id: labelProgress
|
||||||
|
objectName: "labelProgress"
|
||||||
|
font.pointSize: 9
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+550
@@ -0,0 +1,550 @@
|
|||||||
|
// Author: Milan Nikolic <gen2brain@gmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
//go:generate genqrc assets
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"compress/gzip"
|
||||||
|
"fmt"
|
||||||
|
"image"
|
||||||
|
"image/gif"
|
||||||
|
"image/jpeg"
|
||||||
|
"image/png"
|
||||||
|
"mime"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
|
"sort"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/disintegration/imaging"
|
||||||
|
"github.com/dustin/go-humanize"
|
||||||
|
"github.com/gen2brain/cbconvert"
|
||||||
|
"github.com/gographics/imagick/imagick"
|
||||||
|
"github.com/hotei/bmp"
|
||||||
|
"golang.org/x/image/tiff"
|
||||||
|
"gopkg.in/qml.v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Model
|
||||||
|
type Comics struct {
|
||||||
|
Root qml.Object
|
||||||
|
Conv *cbconvert.Convertor
|
||||||
|
List []Comic
|
||||||
|
Len int
|
||||||
|
}
|
||||||
|
|
||||||
|
// Comic Element
|
||||||
|
type Comic struct {
|
||||||
|
Name string
|
||||||
|
Path string
|
||||||
|
Type string
|
||||||
|
Size int64
|
||||||
|
SizeHuman string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sorts by name
|
||||||
|
type ByName []Comic
|
||||||
|
|
||||||
|
func (c ByName) Len() int { return len(c) }
|
||||||
|
func (c ByName) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
|
||||||
|
func (c ByName) Less(i, j int) bool { return c[i].Name < c[j].Name }
|
||||||
|
|
||||||
|
// Sorts by size
|
||||||
|
type BySize []Comic
|
||||||
|
|
||||||
|
func (c BySize) Len() int { return len(c) }
|
||||||
|
func (c BySize) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
|
||||||
|
func (c BySize) Less(i, j int) bool { return c[i].Size < c[j].Size }
|
||||||
|
|
||||||
|
// Sorts by type
|
||||||
|
type ByType []Comic
|
||||||
|
|
||||||
|
func (c ByType) Len() int { return len(c) }
|
||||||
|
func (c ByType) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
|
||||||
|
func (c ByType) Less(i, j int) bool { return c[i].Type < c[j].Type }
|
||||||
|
|
||||||
|
// Adds element to list
|
||||||
|
func (c *Comics) Add(comic Comic) {
|
||||||
|
c.List = append(c.List, comic)
|
||||||
|
c.Len = len(c.List)
|
||||||
|
qml.Changed(c, &c.Len)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Removes element from list
|
||||||
|
func (c *Comics) Remove(i int) {
|
||||||
|
l := c.List
|
||||||
|
l = append(l[:i], l[i+1:]...)
|
||||||
|
c.List = l
|
||||||
|
c.Len = len(c.List)
|
||||||
|
qml.Changed(c, &c.Len)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Removes all elements from list
|
||||||
|
func (c *Comics) RemoveAll() {
|
||||||
|
c.Len = 0
|
||||||
|
c.List = make([]Comic, 0)
|
||||||
|
qml.Changed(c, &c.Len)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sorts by name
|
||||||
|
func (c *Comics) ByName() {
|
||||||
|
sort.Sort(ByName(c.List))
|
||||||
|
c.Len++
|
||||||
|
qml.Changed(c, &c.Len)
|
||||||
|
c.Len--
|
||||||
|
qml.Changed(c, &c.Len)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sorts by size
|
||||||
|
func (c *Comics) BySize() {
|
||||||
|
sort.Sort(BySize(c.List))
|
||||||
|
c.Len++
|
||||||
|
qml.Changed(c, &c.Len)
|
||||||
|
c.Len--
|
||||||
|
qml.Changed(c, &c.Len)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sorts by type
|
||||||
|
func (c *Comics) ByType() {
|
||||||
|
sort.Sort(ByType(c.List))
|
||||||
|
c.Len++
|
||||||
|
qml.Changed(c, &c.Len)
|
||||||
|
c.Len--
|
||||||
|
qml.Changed(c, &c.Len)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns element for given index
|
||||||
|
func (c *Comics) Get(i int) Comic {
|
||||||
|
return c.List[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds elements from fileUrls to list
|
||||||
|
func (c *Comics) AddUrls(u string) {
|
||||||
|
var args []string
|
||||||
|
l := strings.Split(u, "_CBSEP_")
|
||||||
|
re := regexp.MustCompile(`^[a-zA-Z]:`)
|
||||||
|
|
||||||
|
for _, f := range l {
|
||||||
|
f = strings.Replace(f, "file://", "", -1)
|
||||||
|
f = re.ReplaceAllString(f, "")
|
||||||
|
f = re.ReplaceAllString(f, "")
|
||||||
|
args = append(args, f)
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Conv.Opts = c.GetOptions()
|
||||||
|
files := c.Conv.GetFiles(args)
|
||||||
|
|
||||||
|
for _, file := range files {
|
||||||
|
stat, err := os.Stat(file)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error Stat AddUrls: %v\n", err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
m := mime.TypeByExtension(filepath.Ext(file))
|
||||||
|
if m == "" && stat.IsDir() {
|
||||||
|
m = "inode/directory"
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Add(Comic{
|
||||||
|
filepath.Base(file),
|
||||||
|
file,
|
||||||
|
m,
|
||||||
|
stat.Size(),
|
||||||
|
humanize.IBytes(uint64(stat.Size())),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns cbconvert options from qml
|
||||||
|
func (c *Comics) GetOptions() cbconvert.Options {
|
||||||
|
var o cbconvert.Options
|
||||||
|
o.Quiet = true
|
||||||
|
|
||||||
|
r := c.Root.ObjectByName("checkBoxRecursive")
|
||||||
|
o.Recursive = r.Bool("checked")
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("checkBoxNoRGB")
|
||||||
|
o.RGB = !r.Bool("checked")
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("checkBoxConvertCover")
|
||||||
|
o.ConvertCover = !r.Bool("checked")
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("spinboxSize")
|
||||||
|
o.Size = r.Int64("value")
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("sliderBrightness")
|
||||||
|
o.Brightness = r.Float64("value")
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("sliderContrast")
|
||||||
|
o.Contrast = r.Float64("value")
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("checkBoxGrayscale")
|
||||||
|
o.Grayscale = r.Bool("checked")
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("comboBoxFlip")
|
||||||
|
o.Flip = strings.ToLower(r.String("currentText"))
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("comboBoxRotate")
|
||||||
|
o.Rotate, _ = strconv.Atoi(r.String("currentText"))
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("textFieldOutDir")
|
||||||
|
o.Outdir = r.String("text")
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("textFieldSuffix")
|
||||||
|
o.Suffix = r.String("text")
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("checkBoxNonImage")
|
||||||
|
o.NonImage = !r.Bool("checked")
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("comboBoxFormat")
|
||||||
|
o.Format = strings.ToLower(r.String("currentText"))
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("width")
|
||||||
|
o.Width, _ = strconv.Atoi(r.String("text"))
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("height")
|
||||||
|
o.Height, _ = strconv.Atoi(r.String("text"))
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("checkBoxFit")
|
||||||
|
o.Fit = r.Bool("checked")
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("comboBoxFilter")
|
||||||
|
o.Filter = r.Int("currentIndex")
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("sliderQuality")
|
||||||
|
o.Quality = int(r.Float64("value"))
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("spinboxLevelsInMin")
|
||||||
|
o.LevelsInMin = r.Float64("value")
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("spinboxLevelsInMax")
|
||||||
|
o.LevelsInMax = r.Float64("value")
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("spinboxLevelsGamma")
|
||||||
|
o.LevelsGamma = r.Float64("value")
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("spinboxLevelsOutMin")
|
||||||
|
o.LevelsOutMin = r.Float64("value")
|
||||||
|
|
||||||
|
r = c.Root.ObjectByName("spinboxLevelsOutMax")
|
||||||
|
o.LevelsOutMax = r.Float64("value")
|
||||||
|
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets "enabled" property
|
||||||
|
func (c *Comics) SetEnabled(b bool) {
|
||||||
|
c.Root.ObjectByName("checkBoxRecursive").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("checkBoxNoRGB").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("checkBoxConvertCover").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("spinboxSize").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("buttonLevels").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("sliderBrightness").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("sliderContrast").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("checkBoxGrayscale").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("comboBoxFlip").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("comboBoxRotate").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("textFieldOutDir").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("textFieldSuffix").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("checkBoxNonImage").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("comboBoxFormat").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("width").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("height").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("checkBoxFit").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("comboBoxFilter").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("sliderQuality").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("buttonAddFile").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("buttonAddDir").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("buttonRemove").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("buttonRemoveAll").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("buttonThumbnail").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("buttonCover").Set("enabled", b)
|
||||||
|
c.Root.ObjectByName("buttonConvert").Set("enabled", b)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Converts comic
|
||||||
|
func (c *Comics) Convert() {
|
||||||
|
c.Conv.Opts = c.GetOptions()
|
||||||
|
c.Conv.Nfiles = c.Len
|
||||||
|
c.Conv.CurrFile = 0
|
||||||
|
|
||||||
|
c.SetEnabled(false)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
for _, e := range c.List {
|
||||||
|
stat, err := os.Stat(e.Path)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error Stat Convert: %v\n", err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
c.Conv.ConvertComic(e.Path, stat)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
go c.showProgress(true, "Converting...")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extracts cover
|
||||||
|
func (c *Comics) Cover() {
|
||||||
|
c.Conv.Opts = c.GetOptions()
|
||||||
|
c.Conv.Nfiles = c.Len
|
||||||
|
c.Conv.CurrFile = 0
|
||||||
|
|
||||||
|
c.SetEnabled(false)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
for _, e := range c.List {
|
||||||
|
stat, err := os.Stat(e.Path)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error Stat Cover: %v\n", err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
c.Conv.ExtractCover(e.Path, stat)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
go c.showProgress(false, "Extracting...")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extracts thumbnail
|
||||||
|
func (c *Comics) Thumbnail() {
|
||||||
|
c.Conv.Opts = c.GetOptions()
|
||||||
|
c.Conv.Nfiles = c.Len
|
||||||
|
c.Conv.CurrFile = 0
|
||||||
|
|
||||||
|
c.SetEnabled(false)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
for _, e := range c.List {
|
||||||
|
stat, err := os.Stat(e.Path)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error Stat Thumbnail: %v\n", err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
c.Conv.ExtractThumbnail(e.Path, stat)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
go c.showProgress(false, "Extracting...")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shows progress
|
||||||
|
func (c *Comics) showProgress(cn bool, text string) {
|
||||||
|
c.Root.ObjectByName("labelStatus").Set("text", text)
|
||||||
|
c.Root.ObjectByName("progressBar").Set("visible", true)
|
||||||
|
|
||||||
|
for {
|
||||||
|
if c.Conv.CurrFile == c.Conv.Nfiles {
|
||||||
|
if c.Conv.CurrContent == c.Conv.Ncontents {
|
||||||
|
c.Root.ObjectByName("progressBar").Set("value", 0)
|
||||||
|
c.Root.ObjectByName("labelProgress").Set("text", "")
|
||||||
|
c.Root.ObjectByName("labelStatus").Set("text", "Ready")
|
||||||
|
c.Root.ObjectByName("labelPercent").Set("text", "")
|
||||||
|
c.Root.ObjectByName("progressBar").Set("visible", false)
|
||||||
|
c.SetEnabled(true)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var count, current int
|
||||||
|
if cn {
|
||||||
|
count = c.Conv.Ncontents
|
||||||
|
current = c.Conv.CurrContent
|
||||||
|
} else {
|
||||||
|
count = c.Conv.Nfiles
|
||||||
|
current = c.Conv.CurrFile
|
||||||
|
}
|
||||||
|
|
||||||
|
value := float64(current) / float64(count) * 100
|
||||||
|
c.Root.ObjectByName("progressBar").Set("value", float64(value))
|
||||||
|
c.Root.ObjectByName("labelPercent").Set("text",
|
||||||
|
fmt.Sprintf("%d/%d %.0f%%", current, count, float64(value)))
|
||||||
|
c.Root.ObjectByName("labelProgress").Set("text",
|
||||||
|
fmt.Sprintf("File %d of %d", c.Conv.CurrFile, c.Conv.Nfiles))
|
||||||
|
|
||||||
|
time.Sleep(500 * time.Millisecond)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Provides image://cover/
|
||||||
|
func (c *Comics) CoverProvider(file string, width int, height int) image.Image {
|
||||||
|
c.Conv.Opts = c.GetOptions()
|
||||||
|
|
||||||
|
stat, err := os.Stat(file)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error Stat CoverProvider: %v\n", err.Error())
|
||||||
|
return image.NewRGBA(image.Rect(0, 0, width, height))
|
||||||
|
}
|
||||||
|
|
||||||
|
cover, err := c.Conv.GetCoverImage(file, stat)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Error GetCoverImage: %v\n", err.Error())
|
||||||
|
return image.NewRGBA(image.Rect(0, 0, width, height))
|
||||||
|
}
|
||||||
|
|
||||||
|
cover = c.Conv.TransformImage(cover)
|
||||||
|
|
||||||
|
if c.Conv.Opts.LevelsInMin != 0 || c.Conv.Opts.LevelsInMax != 255 || c.Conv.Opts.LevelsGamma != 1.00 ||
|
||||||
|
c.Conv.Opts.LevelsOutMin != 0 || c.Conv.Opts.LevelsOutMax != 255 {
|
||||||
|
cover = c.Conv.LevelImage(cover)
|
||||||
|
}
|
||||||
|
|
||||||
|
// imaging is used for preview only
|
||||||
|
if c.Conv.Opts.Grayscale {
|
||||||
|
cover = imaging.Grayscale(cover)
|
||||||
|
}
|
||||||
|
|
||||||
|
// size preview
|
||||||
|
s := 0
|
||||||
|
b := new(bytes.Buffer)
|
||||||
|
|
||||||
|
w := 0
|
||||||
|
h := 0
|
||||||
|
|
||||||
|
switch c.Conv.Opts.Format {
|
||||||
|
case "jpeg":
|
||||||
|
jpeg.Encode(b, cover, &jpeg.Options{c.Conv.Opts.Quality})
|
||||||
|
s = len(b.Bytes())
|
||||||
|
cover, _ = jpeg.Decode(bytes.NewReader(b.Bytes()))
|
||||||
|
config, _, _ := image.DecodeConfig(bytes.NewReader(b.Bytes()))
|
||||||
|
w = config.Width
|
||||||
|
h = config.Height
|
||||||
|
case "png":
|
||||||
|
png.Encode(b, cover)
|
||||||
|
s = len(b.Bytes())
|
||||||
|
cover, _ = png.Decode(bytes.NewReader(b.Bytes()))
|
||||||
|
config, _, _ := image.DecodeConfig(bytes.NewReader(b.Bytes()))
|
||||||
|
w = config.Width
|
||||||
|
h = config.Height
|
||||||
|
case "gif":
|
||||||
|
mw := imagick.NewMagickWand()
|
||||||
|
defer mw.Destroy()
|
||||||
|
|
||||||
|
mw.ReadImageBlob(c.Conv.GetImageBytes(cover))
|
||||||
|
mw.SetImageFormat("GIF")
|
||||||
|
blob := mw.GetImageBlob()
|
||||||
|
|
||||||
|
s = len(blob)
|
||||||
|
cover, _ = gif.Decode(bytes.NewReader(blob))
|
||||||
|
config, _, _ := image.DecodeConfig(bytes.NewReader(blob))
|
||||||
|
w = config.Width
|
||||||
|
h = config.Height
|
||||||
|
case "tiff":
|
||||||
|
tiff.Encode(b, cover, &tiff.Options{tiff.Uncompressed, false})
|
||||||
|
|
||||||
|
var buf bytes.Buffer
|
||||||
|
gz := gzip.NewWriter(&buf)
|
||||||
|
gz.Write(b.Bytes())
|
||||||
|
gz.Close()
|
||||||
|
|
||||||
|
s = buf.Len()
|
||||||
|
cover, _ = tiff.Decode(bytes.NewReader(b.Bytes()))
|
||||||
|
config, _, _ := image.DecodeConfig(bytes.NewReader(b.Bytes()))
|
||||||
|
w = config.Width
|
||||||
|
h = config.Height
|
||||||
|
case "bmp":
|
||||||
|
mw := imagick.NewMagickWand()
|
||||||
|
defer mw.Destroy()
|
||||||
|
|
||||||
|
bb := c.Conv.GetImageBytes(cover)
|
||||||
|
mw.ReadImageBlob(bb)
|
||||||
|
|
||||||
|
wand := imagick.NewPixelWand()
|
||||||
|
wand.SetColor("black")
|
||||||
|
defer wand.Destroy()
|
||||||
|
|
||||||
|
mw.SetImageFormat("BMP3")
|
||||||
|
mw.SetImageBackgroundColor(wand)
|
||||||
|
mw.SetImageAlphaChannel(imagick.ALPHA_CHANNEL_REMOVE)
|
||||||
|
mw.SetImageAlphaChannel(imagick.ALPHA_CHANNEL_DEACTIVATE)
|
||||||
|
mw.SetImageMatte(false)
|
||||||
|
mw.SetImageCompression(imagick.COMPRESSION_NO)
|
||||||
|
mw.QuantizeImage(16, mw.GetImageColorspace(), 8, true, true)
|
||||||
|
|
||||||
|
var buf bytes.Buffer
|
||||||
|
blob := mw.GetImageBlob()
|
||||||
|
gz := gzip.NewWriter(&buf)
|
||||||
|
gz.Write(blob)
|
||||||
|
gz.Close()
|
||||||
|
|
||||||
|
s = buf.Len()
|
||||||
|
cover, _ = bmp.Decode(bytes.NewReader(blob))
|
||||||
|
config, _, _ := image.DecodeConfig(bytes.NewReader(bb))
|
||||||
|
w = config.Width
|
||||||
|
h = config.Height
|
||||||
|
}
|
||||||
|
|
||||||
|
if cover == nil {
|
||||||
|
return image.NewRGBA(image.Rect(0, 0, width, height))
|
||||||
|
}
|
||||||
|
|
||||||
|
human := humanize.IBytes(uint64(s))
|
||||||
|
c.Root.ObjectByName("sizePreview").Set("text", fmt.Sprintf("%s (%dx%d)", human, w, h))
|
||||||
|
|
||||||
|
return cover
|
||||||
|
}
|
||||||
|
|
||||||
|
func run() error {
|
||||||
|
qml.SetWindowIcon(":///assets/icon.png")
|
||||||
|
|
||||||
|
engine := qml.NewEngine()
|
||||||
|
|
||||||
|
c := &Comics{}
|
||||||
|
engine.Context().SetVar("c", c)
|
||||||
|
|
||||||
|
engine.AddImportPath("qrc:/assets")
|
||||||
|
engine.AddImageProvider("cover", c.CoverProvider)
|
||||||
|
|
||||||
|
q, err := engine.LoadFile("qrc:///assets/main.qml")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
window := q.CreateWindow(nil)
|
||||||
|
c.Root = window.Root()
|
||||||
|
c.Conv = cbconvert.NewConvertor(c.GetOptions())
|
||||||
|
|
||||||
|
c.Root.On("closing", func(o qml.Object) {
|
||||||
|
os.RemoveAll(c.Conv.Workdir)
|
||||||
|
})
|
||||||
|
|
||||||
|
c.Root.ObjectByName("buttonConvert").On("clicked", c.Convert)
|
||||||
|
c.Root.ObjectByName("buttonCover").On("clicked", c.Cover)
|
||||||
|
c.Root.ObjectByName("buttonThumbnail").On("clicked", c.Thumbnail)
|
||||||
|
|
||||||
|
// center window
|
||||||
|
x := c.Root.Int("screenWidth")/2 - c.Root.Int("width")/2
|
||||||
|
y := c.Root.Int("screenHeight")/2 - c.Root.Int("height")/2
|
||||||
|
window.Set("x", x)
|
||||||
|
window.Set("y", y)
|
||||||
|
|
||||||
|
window.Show()
|
||||||
|
window.Wait()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if err := qml.Run(run); err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "error: %v\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
Executable
+32
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
CHROOT="/home/milann/chroot"
|
||||||
|
MINGW="/usr/i686-w64-mingw32"
|
||||||
|
|
||||||
|
mkdir -p build
|
||||||
|
rm -f resource.syso
|
||||||
|
|
||||||
|
go generate
|
||||||
|
|
||||||
|
LIBRARY_PATH="$CHROOT/usr/lib:$CHROOT/lib" \
|
||||||
|
PKG_CONFIG_PATH="$CHROOT/usr/lib/pkgconfig" \
|
||||||
|
PKG_CONFIG_LIBDIR="$CHROOT/usr/lib/pkgconfig" \
|
||||||
|
CGO_LDFLAGS="-L$CHROOT/usr/lib -L$CHROOT/lib -L$CHROOT/usr/plugins/generic -L$CHROOT/usr/plugins/platforms -L$CHROOT/usr/plugins/qmltooling -L$CHROOT/usr/qml/QtQuick.2 -L$CHROOT/usr/qml/QtQuick/Controls -L$CHROOT/usr/qml/QtQuick/Dialogs -L$CHROOT/usr/qml/QtQuick/Layouts -L$CHROOT/usr/qml/QtQuick/Window.2 -L$CHROOT/usr/qml/Qt/labs/settings -L$CHROOT/usr/qml/QtQuick/PrivateWidgets -L$CHROOT/usr/plugins/xcbglintegrations" \
|
||||||
|
CGO_LDFLAGS="$CGO_LDFLAGS -lqxcb -lqtquick2plugin -lqtquickcontrolsplugin -ldialogplugin -lqquicklayoutsplugin -lwindowplugin -lqmlsettingsplugin -lwidgetsplugin -lqxcb-glx-integration -lqevdevkeyboardplugin -lqevdevmouseplugin" \
|
||||||
|
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -v -x -o build/cbconvert
|
||||||
|
strip build/cbconvert
|
||||||
|
|
||||||
|
goversioninfo -icon=assets/icon.ico
|
||||||
|
|
||||||
|
PKG_CONFIG="/usr/bin/i686-w64-mingw32-pkg-config" \
|
||||||
|
PKG_CONFIG_PATH="$MINGW/usr/lib/pkgconfig:$MINGW/usr/lib/pkgconfig" \
|
||||||
|
PKG_CONFIG_LIBDIR="$MINGW/usr/lib/pkgconfig:$MINGW/usr/lib/pkgconfig" \
|
||||||
|
CGO_LDFLAGS="-L$MINGW/usr/lib -L$MINGW/lib -L$MINGW/usr/plugins/generic -L$MINGW/usr/plugins/platforms -L$MINGW/usr/qml/Qt/labs/folderlistmodel -L$MINGW/usr/plugins/qmltooling -L$MINGW/usr/qml/QtQuick.2 -L$MINGW/usr/qml/QtQuick/Controls -L$MINGW/usr/qml/QtQuick/Dialogs -L$MINGW/usr/qml/QtQuick/Dialogs/Private -L$MINGW/usr/qml/QtQuick/Layouts -L$MINGW/usr/qml/QtQuick/Window.2 -L$MINGW/usr/qml/Qt/labs/settings -L$MINGW/usr/qml/QtQuick/PrivateWidgets" \
|
||||||
|
CGO_LDFLAGS="$CGO_LDFLAGS -lqwindows -lqtquick2plugin -lqtquickcontrolsplugin -lqmlfolderlistmodelplugin -ldialogplugin -ldialogsprivateplugin -lqquicklayoutsplugin -lwindowplugin -lqmlsettingsplugin -lwidgetsplugin" \
|
||||||
|
CGO_CFLAGS="-I$MINGW/usr/include -Wno-poison-system-directories" \
|
||||||
|
CGO_CXXFLAGS="-I$MINGW/usr/include -Wno-poison-system-directories" \
|
||||||
|
CGO_CPPFLAGS="-I$MINGW/usr/include -Wno-poison-system-directories" \
|
||||||
|
CC="i686-w64-mingw32-gcc" CXX="i686-w64-mingw32-g++" \
|
||||||
|
CC_FOR_TARGET="i686-w64-mingw32-gcc" CXX_FOR_TARGET="i686-w64-mingw32-g++" \
|
||||||
|
CGO_ENABLED=1 GOOS=windows GOARCH=386 go build -v -x -o build/cbconvert.exe -ldflags "-H=windowsgui -linkmode external '-extldflags=-static -Wl,--allow-multiple-definition'"
|
||||||
|
i686-w64-mingw32-strip build/cbconvert.exe
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"FixedFileInfo":
|
||||||
|
{
|
||||||
|
"FileVersion": {
|
||||||
|
"Major": 0,
|
||||||
|
"Minor": 6,
|
||||||
|
"Patch": 0,
|
||||||
|
"Build": 0
|
||||||
|
},
|
||||||
|
"ProductVersion": {
|
||||||
|
"Major": 0,
|
||||||
|
"Minor": 6,
|
||||||
|
"Patch": 0,
|
||||||
|
"Build": 0
|
||||||
|
},
|
||||||
|
"FileFlagsMask": "3f",
|
||||||
|
"FileFlags ": "00",
|
||||||
|
"FileOS": "040004",
|
||||||
|
"FileType": "01",
|
||||||
|
"FileSubType": "00"
|
||||||
|
},
|
||||||
|
"StringFileInfo":
|
||||||
|
{
|
||||||
|
"Comments": "Comic Book converter",
|
||||||
|
"CompanyName": "",
|
||||||
|
"FileDescription": "CBconvert GUI",
|
||||||
|
"FileVersion": "0.6.0",
|
||||||
|
"InternalName": "",
|
||||||
|
"LegalCopyright": "",
|
||||||
|
"LegalTrademarks": "",
|
||||||
|
"OriginalFilename": "cbconvert.exe",
|
||||||
|
"PrivateBuild": "",
|
||||||
|
"ProductName": "CBconvert",
|
||||||
|
"ProductVersion": "0.6.0",
|
||||||
|
"SpecialBuild": ""
|
||||||
|
},
|
||||||
|
"VarFileInfo":
|
||||||
|
{
|
||||||
|
"Translation": {
|
||||||
|
"LangID": "0409",
|
||||||
|
"CharsetID": "04B0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
mkdir -p build
|
|
||||||
|
|
||||||
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o build/cbconvert
|
|
||||||
strip build/cbconvert
|
|
||||||
|
|
||||||
CGO_LDFLAGS="-L/usr/i686-pc-mingw32/usr/lib" \
|
|
||||||
CGO_CFLAGS="-I/usr/i686-pc-mingw32/usr/include -I/usr/i686-pc-mingw32/usr/include/poppler/glib -I/usr/i686-pc-mingw32/usr/include/glib-2.0 -I/usr/i686-pc-mingw32/usr/include/cairo" \
|
|
||||||
CGO_CXXFLAGS="-I/usr/i686-pc-mingw32/usr/include -I/usr/i686-pc-mingw32/usr/include/poppler/glib -I/usr/i686-pc-mingw32/usr/include/glib-2.0 -I/usr/i686-pc-mingw32/usr/include/cairo" \
|
|
||||||
CGO_CPPFLAGS="-I/usr/i686-pc-mingw32/usr/include -I/usr/i686-pc-mingw32/usr/include/poppler/glib -I/usr/i686-pc-mingw32/usr/include/glib-2.0 -I/usr/i686-pc-mingw32/usr/include/cairo" \
|
|
||||||
PKG_CONFIG=/usr/bin/i686-pc-mingw32-pkg-config \
|
|
||||||
PKG_CONFIG_PATH=/usr/i686-pc-mingw32/usr/lib/pkgconfig \
|
|
||||||
PKG_CONFIG_LIBDIR=/usr/i686-pc-mingw32/usr/lib/pkgconfig \
|
|
||||||
CC="i686-pc-mingw32-gcc" CXX="i686-pc-mingw32-g++" \
|
|
||||||
CC_FOR_TARGET=i686-pc-mingw32-gcc CXX_FOR_TARGET=i686-pc-mingw32-g++ \
|
|
||||||
CGO_ENABLED=1 GOOS=windows GOARCH=386 go build -x -work -o build/cbconvert.exe -ldflags "-linkmode external -extldflags -static"
|
|
||||||
i686-pc-mingw32-strip build/cbconvert.exe
|
|
||||||
Reference in New Issue
Block a user