mirror of
https://github.com/ciromattia/kcc
synced 2026-06-30 18:15:24 +00:00
Code cleaning
This commit is contained in:
+7
-13
@@ -131,7 +131,7 @@ def buildNCX(dstdir, title, chapters):
|
|||||||
def buildOPF(profile, dstdir, title, filelist, cover=None, righttoleft=False):
|
def buildOPF(profile, dstdir, title, filelist, cover=None, righttoleft=False):
|
||||||
opffile = os.path.join(dstdir, 'OEBPS', 'content.opf')
|
opffile = os.path.join(dstdir, 'OEBPS', 'content.opf')
|
||||||
# read the first file resolution
|
# read the first file resolution
|
||||||
profilelabel, deviceres, palette, gamma = image.ProfileData.Profiles[profile]
|
profilelabel, deviceres, palette, gamma, panelviewsize = image.ProfileData.Profiles[profile]
|
||||||
imgres = str(deviceres[0]) + "x" + str(deviceres[1])
|
imgres = str(deviceres[0]) + "x" + str(deviceres[1])
|
||||||
if righttoleft:
|
if righttoleft:
|
||||||
writingmode = "horizontal-rl"
|
writingmode = "horizontal-rl"
|
||||||
@@ -435,13 +435,13 @@ def main(argv=None):
|
|||||||
usage = "Usage: %prog [options] comic_file|comic_folder"
|
usage = "Usage: %prog [options] comic_file|comic_folder"
|
||||||
parser = OptionParser(usage=usage, version=__version__)
|
parser = OptionParser(usage=usage, version=__version__)
|
||||||
parser.add_option("-p", "--profile", action="store", dest="profile", default="KHD",
|
parser.add_option("-p", "--profile", action="store", dest="profile", default="KHD",
|
||||||
help="Device profile (Choose one among K1, K2, K3, K4, KDX, KDXG or KHD) [Default=KHD]")
|
help="Device profile (Choose one among K1, K2, K3, K4NT, K4T, KDX, KDXG or KHD) [Default=KHD]")
|
||||||
parser.add_option("-t", "--title", action="store", dest="title", default="defaulttitle",
|
parser.add_option("-t", "--title", action="store", dest="title", default="defaulttitle",
|
||||||
help="Comic title [Default=filename]")
|
help="Comic title [Default=filename]")
|
||||||
parser.add_option("-m", "--manga-style", action="store_true", dest="righttoleft", default=False,
|
parser.add_option("-m", "--manga-style", action="store_true", dest="righttoleft", default=False,
|
||||||
help="Manga style (Right-to-left reading and splitting) [Default=False]")
|
help="Manga style (Right-to-left reading and splitting) [Default=False]")
|
||||||
parser.add_option("--panelview", action="store_true", dest="panelview", default=False,
|
parser.add_option("--panelview", action="store_true", dest="panelview", default=False,
|
||||||
help="Add Panel View support (For Kindle Classic and Kindle Keyboard) [Default=False]")
|
help="Add Panel View support (For Kindle Non-Touch and Kindle Keyboard) [Default=False]")
|
||||||
parser.add_option("--noprocessing", action="store_false", dest="imgproc", default=True,
|
parser.add_option("--noprocessing", action="store_false", dest="imgproc", default=True,
|
||||||
help="Do not apply image preprocessing (Page splitting and optimizations) [Default=True]")
|
help="Do not apply image preprocessing (Page splitting and optimizations) [Default=True]")
|
||||||
parser.add_option("--nodithering", action="store_true", dest="notquantize", default=False,
|
parser.add_option("--nodithering", action="store_true", dest="notquantize", default=False,
|
||||||
@@ -500,22 +500,16 @@ def main(argv=None):
|
|||||||
|
|
||||||
def checkOptions():
|
def checkOptions():
|
||||||
global options
|
global options
|
||||||
if options.profile == 'K4' or options.profile == 'KHD':
|
if options.profile == 'K4NT' or options.profile == 'K4T' or options.profile == 'KHD':
|
||||||
options.landscapemode = True
|
options.landscapemode = True
|
||||||
else:
|
else:
|
||||||
options.landscapemode = False
|
options.landscapemode = False
|
||||||
if (options.fakepanelview or options.fakepanelviewlandscape) and options.profile == 'KHD':
|
if options.panelview and not (options.profile == 'K3' or options.profile == 'K4NT'):
|
||||||
options.fakepanelview = False
|
options.panelview = False
|
||||||
options.fakepanelviewlandscape = False
|
if options.panelview:
|
||||||
if (options.fakepanelview or options.fakepanelviewlandscape) and options.landscapemode:
|
|
||||||
options.landscapemode = False
|
options.landscapemode = False
|
||||||
if options.fakepanelview or options.fakepanelviewlandscape:
|
|
||||||
options.imgproc = True
|
|
||||||
options.upscale = True
|
|
||||||
options.rotate = False
|
options.rotate = False
|
||||||
options.nosplitrotate = False
|
options.nosplitrotate = False
|
||||||
if options.fakepanelview and options.fakepanelviewlandscape:
|
|
||||||
options.fakepanelviewlandscape = False
|
|
||||||
|
|
||||||
|
|
||||||
def getEpubPath():
|
def getEpubPath():
|
||||||
|
|||||||
+4
-4
@@ -77,10 +77,10 @@ class ProfileData:
|
|||||||
]
|
]
|
||||||
|
|
||||||
Profiles = {
|
Profiles = {
|
||||||
'K1': ("Kindle", (600, 800), Palette4, 1.8, (900, 1200)),
|
'K1': ("Kindle 1", (600, 800), Palette4, 1.8, (900, 1200)),
|
||||||
'K2': ("Kindle 2", (600, 800), Palette15, 1.8, (900, 1200)),
|
'K2': ("Kindle 2", (600, 800), Palette15, 1.8, (900, 1200)),
|
||||||
'K3': ("Kindle Keyboard", (600, 800), Palette16, 1.8, (900, 1200)),
|
'K3': ("Kindle Keyboard", (600, 800), Palette16, 1.8, (900, 1200)),
|
||||||
'K4NT': ("Kindle Classic", (600, 800), Palette16, 1.8, (900, 1200)),
|
'K4NT': ("Kindle Non-Touch", (600, 800), Palette16, 1.8, (900, 1200)),
|
||||||
'K4T': ("Kindle Touch", (600, 800), Palette16, 1.8, (900, 1200)),
|
'K4T': ("Kindle Touch", (600, 800), Palette16, 1.8, (900, 1200)),
|
||||||
'KHD': ("Kindle Paperwhite", (758, 1024), Palette16, 1.8, (1137, 1536)),
|
'KHD': ("Kindle Paperwhite", (758, 1024), Palette16, 1.8, (1137, 1536)),
|
||||||
'KDX': ("Kindle DX", (824, 1200), Palette15, 1.8, (1236, 1800)),
|
'KDX': ("Kindle DX", (824, 1200), Palette15, 1.8, (1236, 1800)),
|
||||||
@@ -88,10 +88,10 @@ class ProfileData:
|
|||||||
}
|
}
|
||||||
|
|
||||||
ProfileLabels = {
|
ProfileLabels = {
|
||||||
"Kindle": 'K1',
|
"Kindle 1": 'K1',
|
||||||
"Kindle 2": 'K2',
|
"Kindle 2": 'K2',
|
||||||
"Kindle Keyboard": 'K3',
|
"Kindle Keyboard": 'K3',
|
||||||
"Kindle Classic": 'K4NT',
|
"Kindle Non-Touch": 'K4NT',
|
||||||
"Kindle Touch": 'K4T',
|
"Kindle Touch": 'K4T',
|
||||||
"Kindle Paperwhite": 'KHD',
|
"Kindle Paperwhite": 'KHD',
|
||||||
"Kindle DX": 'KDX',
|
"Kindle DX": 'KDX',
|
||||||
|
|||||||
Reference in New Issue
Block a user