about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--LICENSE.txt2
-rw-r--r--README.md2
-rwxr-xr-xkcc-c2e.py2
-rwxr-xr-xkcc-c2p.py2
-rw-r--r--kcc.iss2
-rwxr-xr-xkcc.py2
-rw-r--r--kcc/KCC_gui.py2
-rw-r--r--kcc/__init__.py2
-rw-r--r--kcc/cbxarchive.py2
-rwxr-xr-xkcc/comic2ebook.py20
-rw-r--r--kcc/comic2panel.py2
-rw-r--r--kcc/dualmetafix.py2
-rwxr-xr-xkcc/image.py8
-rw-r--r--kcc/kindle.py2
-rw-r--r--kcc/metadata.py2
-rw-r--r--kcc/pdfjpgextract.py2
-rw-r--r--kcc/shared.py10
-rwxr-xr-xother/osx/7zabin1459896 -> 1122372 bytes
-rw-r--r--other/osx/Info.plist2
-rwxr-xr-xother/osx/unrarbin283000 -> 266404 bytes
-rw-r--r--other/windows/7za.exebin587776 -> 643072 bytes
-rw-r--r--other/windows/UnRAR.exebin310872 -> 315384 bytes
22 files changed, 35 insertions, 33 deletions
diff --git a/LICENSE.txt b/LICENSE.txt
index b0eadda..cfe3e84 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,7 +1,7 @@
 ISC LICENSE
 
 Copyright (c) 2012-2014 Ciro Mattia Gonano <[email protected]>
-Copyright (c) 2013-2015 Paweł Jastrzębski <[email protected]>
+Copyright (c) 2013-2016 Paweł Jastrzębski <[email protected]>
 
 Permission to use, copy, modify, and/or distribute this software for
 any purpose with or without fee is hereby granted, provided that the
diff --git a/README.md b/README.md
index 678e6ae..f814c9c 100644
--- a/README.md
+++ b/README.md
@@ -460,5 +460,5 @@ Error report include **KCC** version, OS version and content of error message.
 Please check [wiki page](https://github.com/ciromattia/kcc/wiki/Known-issues).
 
 ## COPYRIGHT
-Copyright (c) 2012-2015 Ciro Mattia Gonano and Paweł Jastrzębski.
+Copyright (c) 2012-2016 Ciro Mattia Gonano and Paweł Jastrzębski.
 **KCC** is released under ISC LICENSE; see LICENSE.txt for further details.
diff --git a/kcc-c2e.py b/kcc-c2e.py
index 0d3fbf6..c98ae0b 100755
--- a/kcc-c2e.py
+++ b/kcc-c2e.py
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 #
 # Copyright (c) 2012-2014 Ciro Mattia Gonano <[email protected]>
-# Copyright (c) 2013-2015 Pawel Jastrzebski <[email protected]>
+# Copyright (c) 2013-2016 Pawel Jastrzebski <[email protected]>
 #
 # Permission to use, copy, modify, and/or distribute this software for
 # any purpose with or without fee is hereby granted, provided that the
diff --git a/kcc-c2p.py b/kcc-c2p.py
index a1ded61..adab111 100755
--- a/kcc-c2p.py
+++ b/kcc-c2p.py
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 #
 # Copyright (c) 2012-2014 Ciro Mattia Gonano <[email protected]>
-# Copyright (c) 2013-2015 Pawel Jastrzebski <[email protected]>
+# Copyright (c) 2013-2016 Pawel Jastrzebski <[email protected]>
 #
 # Permission to use, copy, modify, and/or distribute this software for
 # any purpose with or without fee is hereby granted, provided that the
diff --git a/kcc.iss b/kcc.iss
index 749e586..13bc561 100644
--- a/kcc.iss
+++ b/kcc.iss
@@ -12,7 +12,7 @@ AppPublisher={#MyAppPublisher}
 AppPublisherURL={#MyAppURL}
 AppSupportURL={#MyAppURL}
 AppUpdatesURL={#MyAppURL}
-AppCopyright=Copyright (C) 2012-2015 Ciro Mattia Gonano and Paweł Jastrzębski
+AppCopyright=Copyright (C) 2012-2016 Ciro Mattia Gonano and Paweł Jastrzębski
 ArchitecturesAllowed=x64 
 DefaultDirName={pf}\{#MyAppName}
 DefaultGroupName={#MyAppName}
diff --git a/kcc.py b/kcc.py
index 0029ad7..47a38de 100755
--- a/kcc.py
+++ b/kcc.py
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 #
 # Copyright (c) 2012-2014 Ciro Mattia Gonano <[email protected]>
-# Copyright (c) 2013-2015 Pawel Jastrzebski <[email protected]>
+# Copyright (c) 2013-2016 Pawel Jastrzebski <[email protected]>
 #
 # Permission to use, copy, modify, and/or distribute this software for
 # any purpose with or without fee is hereby granted, provided that the
diff --git a/kcc/KCC_gui.py b/kcc/KCC_gui.py
index be36490..d8ef8f2 100644
--- a/kcc/KCC_gui.py
+++ b/kcc/KCC_gui.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 #
 # Copyright (c) 2012-2014 Ciro Mattia Gonano <[email protected]>
-# Copyright (c) 2013-2015 Pawel Jastrzebski <[email protected]>
+# Copyright (c) 2013-2016 Pawel Jastrzebski <[email protected]>
 #
 # Permission to use, copy, modify, and/or distribute this software for
 # any purpose with or without fee is hereby granted, provided that the
diff --git a/kcc/__init__.py b/kcc/__init__.py
index 04c0270..bd7dc49 100644
--- a/kcc/__init__.py
+++ b/kcc/__init__.py
@@ -1,4 +1,4 @@
 __version__ = '5.0.1'
 __license__ = 'ISC'
-__copyright__ = '2012-2015, Ciro Mattia Gonano <[email protected]>, Pawel Jastrzebski <[email protected]>'
+__copyright__ = '2012-2016, Ciro Mattia Gonano <[email protected]>, Pawel Jastrzebski <[email protected]>'
 __docformat__ = 'restructuredtext en'
diff --git a/kcc/cbxarchive.py b/kcc/cbxarchive.py
index f802b91..569dad5 100644
--- a/kcc/cbxarchive.py
+++ b/kcc/cbxarchive.py
@@ -1,5 +1,5 @@
 # Copyright (c) 2012-2014 Ciro Mattia Gonano <[email protected]>
-# Copyright (c) 2013-2015 Pawel Jastrzebski <[email protected]>
+# Copyright (c) 2013-2016 Pawel Jastrzebski <[email protected]>
 #
 # Permission to use, copy, modify, and/or distribute this software for
 # any purpose with or without fee is hereby granted, provided that the
diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py
index 8b6dd84..b069311 100755
--- a/kcc/comic2ebook.py
+++ b/kcc/comic2ebook.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 #
 # Copyright (c) 2012-2014 Ciro Mattia Gonano <[email protected]>
-# Copyright (c) 2013-2015 Pawel Jastrzebski <[email protected]>
+# Copyright (c) 2013-2016 Pawel Jastrzebski <[email protected]>
 #
 # Permission to use, copy, modify, and/or distribute this software for
 # any purpose with or without fee is hereby granted, provided that the
@@ -545,10 +545,10 @@ def imgFileProcessing(work):
         workImg = image.ComicPageParser((dirpath, afile), opt)
         for i in workImg.payload:
             img = image.ComicPage(i[0], i[1], i[2], i[3], i[4], opt)
-            if not opt.webtoon:
-                img.cropWhiteSpace()
-            if opt.cutpagenumbers and not opt.webtoon:
-                img.cutPageNumber()
+            if opt.cropping > 0 and not opt.webtoon:
+                img.cropWhiteSpace(opt.croppingp)
+            if opt.cropping == 2 and not opt.webtoon:
+                img.cutPageNumber(opt.croppingpn)
             img.autocontrastImage()
             img.resizeImage()
             if opt.forcepng and not opt.forcecolor:
@@ -556,7 +556,7 @@ def imgFileProcessing(work):
             output.append(img.saveToDir())
         return output
     except Exception:
-        return str(sys.exc_info()[1])
+        return str(sys.exc_info()[:2])
 
 
 def getWorkFolder(afile):
@@ -989,8 +989,12 @@ def makeParser():
                                  help="Don't convert images to grayscale")
     processingOptions.add_option("--forcepng", action="store_true", dest="forcepng", default=False,
                                  help="Create PNG files instead JPEG")
-    processingOptions.add_option("--nocutpagenumbers", action="store_false", dest="cutpagenumbers", default=True,
-                                 help="Don't try to cut page numbers from images")
+    processingOptions.add_option("--cropping", type="int", dest="cropping", default="2",
+                                 help="Set cropping mode. 0: Disabled 1: Margins 2: Margins + page numbers [Default=2]")
+    processingOptions.add_option("--croppingpower", type="float", dest="croppingp", default="0.1",
+                                 help="Set margin cropping threshold [Default=0.1]")
+    processingOptions.add_option("--croppingpowerpage", type="float", dest="croppingpn", default="5.0",
+                                 help="Set page number cropping threshold [Default=5.0]")
 
     customProfileOptions.add_option("--customwidth", type="int", dest="customwidth", default=0,
                                     help="Replace screen width provided by device profile")
diff --git a/kcc/comic2panel.py b/kcc/comic2panel.py
index fa57535..6602a91 100644
--- a/kcc/comic2panel.py
+++ b/kcc/comic2panel.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 #
 # Copyright (c) 2012-2014 Ciro Mattia Gonano <[email protected]>
-# Copyright (c) 2013-2015 Pawel Jastrzebski <[email protected]>
+# Copyright (c) 2013-2016 Pawel Jastrzebski <[email protected]>
 #
 # Permission to use, copy, modify, and/or distribute this software for
 # any purpose with or without fee is hereby granted, provided that the
diff --git a/kcc/dualmetafix.py b/kcc/dualmetafix.py
index 0d0ce04..ffb9890 100644
--- a/kcc/dualmetafix.py
+++ b/kcc/dualmetafix.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 #
 # Based on initial version of DualMetaFix. Copyright (C) 2013 Kevin Hendricks
-# Changes for KCC Copyright (C) 2014-2015 Pawel Jastrzebski <[email protected]>
+# Changes for KCC Copyright (C) 2014-2016 Pawel Jastrzebski <[email protected]>
 #
 # 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
diff --git a/kcc/image.py b/kcc/image.py
index 2126af2..7fe03da 100755
--- a/kcc/image.py
+++ b/kcc/image.py
@@ -1,7 +1,7 @@
 # Copyright (C) 2010  Alex Yatskov
 # Copyright (C) 2011  Stanislav (proDOOMman) Kosolapov <[email protected]>
 # Copyright (c) 2012-2014 Ciro Mattia Gonano <[email protected]>
-# Copyright (c) 2013-2015 Pawel Jastrzebski <[email protected]>
+# Copyright (c) 2013-2016 Pawel Jastrzebski <[email protected]>
 #
 # 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
@@ -316,12 +316,11 @@ class ComicPage:
                     if self.image.size[0] > size[0] or self.image.size[1] > size[1]:
                         self.image.thumbnail(size, Image.LANCZOS)
 
-    def cutPageNumber(self):
+    def cutPageNumber(self, fixedThreshold):
         if ImageChops.invert(self.image).getbbox() is not None:
             widthImg, heightImg = self.image.size
             delta = 2
             diff = delta
-            fixedThreshold = 5
             if ImageStat.Stat(self.image).var[0] < 2 * fixedThreshold:
                 return self.image
             while ImageStat.Stat(self.image.crop((0, heightImg - diff, widthImg, heightImg))).var[0] < fixedThreshold\
@@ -370,12 +369,11 @@ class ComicPage:
                 diff = pageNumberCut1
             self.image = self.image.crop((0, 0, widthImg, heightImg - diff))
 
-    def cropWhiteSpace(self):
+    def cropWhiteSpace(self, fixedThreshold):
         if ImageChops.invert(self.image).getbbox() is not None:
             widthImg, heightImg = self.image.size
             delta = 10
             diff = delta
-            fixedThreshold = 0.1
             # top
             while ImageStat.Stat(self.image.crop((0, 0, widthImg, diff))).var[0] < fixedThreshold and diff < heightImg:
                 diff += delta
diff --git a/kcc/kindle.py b/kcc/kindle.py
index d00befb..90e15e1 100644
--- a/kcc/kindle.py
+++ b/kcc/kindle.py
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #
-# Copyright (c) 2013-2015 Pawel Jastrzebski <[email protected]>
+# Copyright (c) 2013-2016 Pawel Jastrzebski <[email protected]>
 #
 # Permission to use, copy, modify, and/or distribute this software for
 # any purpose with or without fee is hereby granted, provided that the
diff --git a/kcc/metadata.py b/kcc/metadata.py
index 60d19cf..2dd51c5 100644
--- a/kcc/metadata.py
+++ b/kcc/metadata.py
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #
-# Copyright (c) 2013-2015 Pawel Jastrzebski <[email protected]>
+# Copyright (c) 2013-2016 Pawel Jastrzebski <[email protected]>
 #
 # Permission to use, copy, modify, and/or distribute this software for
 # any purpose with or without fee is hereby granted, provided that the
diff --git a/kcc/pdfjpgextract.py b/kcc/pdfjpgextract.py
index 8cd9d6d..06403ad 100644
--- a/kcc/pdfjpgextract.py
+++ b/kcc/pdfjpgextract.py
@@ -1,5 +1,5 @@
 # Copyright (c) 2012-2014 Ciro Mattia Gonano <[email protected]>
-# Copyright (c) 2013-2015 Pawel Jastrzebski <[email protected]>
+# Copyright (c) 2013-2016 Pawel Jastrzebski <[email protected]>
 #
 # Based upon the code snippet by Ned Batchelder
 # (http://nedbatchelder.com/blog/200712/extracting_jpgs_from_pdfs.html)
diff --git a/kcc/shared.py b/kcc/shared.py
index 72b5020..72bc07a 100644
--- a/kcc/shared.py
+++ b/kcc/shared.py
@@ -1,5 +1,5 @@
 # Copyright (c) 2012-2014 Ciro Mattia Gonano <[email protected]>
-# Copyright (c) 2013-2015 Pawel Jastrzebski <[email protected]>
+# Copyright (c) 2013-2016 Pawel Jastrzebski <[email protected]>
 #
 # Permission to use, copy, modify, and/or distribute this software for
 # any purpose with or without fee is hereby granted, provided that the
@@ -97,7 +97,7 @@ def check7ZFile(filePath):
 
 
 def saferReplace(old, new):
-    for x in range(10):
+    for x in range(30):
         try:
             os.replace(old, new)
         except PermissionError:
@@ -109,7 +109,7 @@ def saferReplace(old, new):
 
 
 def saferRemove(target):
-    for x in range(10):
+    for x in range(30):
         try:
             os.remove(target)
         except PermissionError:
@@ -129,11 +129,11 @@ def removeFromZIP(zipfname, *filenames):
                 for item in zipread.infolist():
                     if item.filename not in filenames:
                         zipwrite.writestr(item, zipread.read(item.filename))
-        for x in range(50):
+        for x in range(30):
             try:
                 copy(tempname, zipfname)
             except PermissionError:
-                sleep(0.1)
+                sleep(1)
             else:
                 break
         else:
diff --git a/other/osx/7za b/other/osx/7za
index 8669495..f92fa21 100755
--- a/other/osx/7za
+++ b/other/osx/7za
Binary files differdiff --git a/other/osx/Info.plist b/other/osx/Info.plist
index cda8b2d..542e230 100644
--- a/other/osx/Info.plist
+++ b/other/osx/Info.plist
@@ -9,7 +9,7 @@
 	<key>CFBundleExecutable</key>
 	<string>MacOS/Kindle Comic Converter</string>
 	<key>CFBundleGetInfoString</key>
-	<string>KindleComicConverter 5.0.1, written 2012-2015 by Ciro Mattia Gonano and Pawel Jastrzebski</string>
+	<string>KindleComicConverter 5.0.1, written 2012-2016 by Ciro Mattia Gonano and Pawel Jastrzebski</string>
 	<key>CFBundleIconFile</key>
 	<string>comic2ebook.icns</string>
 	<key>CFBundleIdentifier</key>
diff --git a/other/osx/unrar b/other/osx/unrar
index 02e3413..8ca581d 100755
--- a/other/osx/unrar
+++ b/other/osx/unrar
Binary files differdiff --git a/other/windows/7za.exe b/other/windows/7za.exe
index 7f6bf86..fc8a0bd 100644
--- a/other/windows/7za.exe
+++ b/other/windows/7za.exe
Binary files differdiff --git a/other/windows/UnRAR.exe b/other/windows/UnRAR.exe
index cfc0c07..28840c1 100644
--- a/other/windows/UnRAR.exe
+++ b/other/windows/UnRAR.exe
Binary files differ