From 2ee5dc310bcc72d8e4b6f24d2c67bc2db48037c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Tue, 8 Apr 2014 13:10:34 +0200 Subject: [PATCH] Fixed No optimization mode (close #88) --- kcc/comic2ebook.py | 77 +++++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index b86e55d..9eeac42 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -51,21 +51,27 @@ def buildHTML(path, imgfile, imgfilepath): imgfilepath = md5Checksum(imgfilepath) filename = getImageFileName(imgfile) if filename is not None: - if "Rotated" in theGreatIndex[imgfilepath]: - rotatedPage = True + if options.imgproc: + if "Rotated" in theGreatIndex[imgfilepath]: + rotatedPage = True + else: + rotatedPage = False + if "NoPanelView" in theGreatIndex[imgfilepath]: + noPV = True + else: + noPV = False + if "NoHorizontalPanelView" in theGreatIndex[imgfilepath]: + noHorizontalPV = True + else: + noHorizontalPV = False + if "NoVerticalPanelView" in theGreatIndex[imgfilepath]: + noVerticalPV = True + else: + noVerticalPV = False else: rotatedPage = False - if "NoPanelView" in theGreatIndex[imgfilepath]: - noPV = True - else: noPV = False - if "NoHorizontalPanelView" in theGreatIndex[imgfilepath]: - noHorizontalPV = True - else: noHorizontalPV = False - if "NoVerticalPanelView" in theGreatIndex[imgfilepath]: - noVerticalPV = True - else: noVerticalPV = False htmlpath = '' postfix = '' @@ -163,30 +169,31 @@ def buildHTML(path, imgfile, imgfilepath): def checkMargins(path): - for flag in theGreatIndex[path]: - if "Margins-" in flag: - flag = flag.split('-') - xl = flag[1] - yu = flag[2] - xr = flag[3] - yd = flag[4] - if xl != "0": - xl = "-" + str(float(xl)/100) + "%" - else: - xl = "0%" - if xr != "0": - xr = "-" + str(float(xr)/100) + "%" - else: - xr = "0%" - if yu != "0": - yu = "-" + str(float(yu)/100) + "%" - else: - yu = "0%" - if yd != "0": - yd = "-" + str(float(yd)/100) + "%" - else: - yd = "0%" - return xl, yu, xr, yd + if options.imgproc: + for flag in theGreatIndex[path]: + if "Margins-" in flag: + flag = flag.split('-') + xl = flag[1] + yu = flag[2] + xr = flag[3] + yd = flag[4] + if xl != "0": + xl = "-" + str(float(xl)/100) + "%" + else: + xl = "0%" + if xr != "0": + xr = "-" + str(float(xr)/100) + "%" + else: + xr = "0%" + if yu != "0": + yu = "-" + str(float(yu)/100) + "%" + else: + yu = "0%" + if yd != "0": + yd = "-" + str(float(yd)/100) + "%" + else: + yd = "0%" + return xl, yu, xr, yd return '0%', '0%', '0%', '0%'