From 4a412816d9dfec1edef1fc7fa8e1112829273b94 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Wed, 30 Oct 2024 15:22:11 -0700 Subject: [PATCH 1/5] refactor --- kindlecomicconverter/comic2ebook.py | 13 ++++++------- kindlecomicconverter/image.py | 10 +++++++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index e5bb4b4a..66f911d1 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -1046,16 +1046,15 @@ def checkOptions(options): options.kfx = False options.supportSyntheticSpread = False if options.format == 'Auto': - if options.profile in ['K1', 'K2', 'K34', 'K578', 'KPW', 'KPW5', 'KPW6', 'KCS12', 'KV', 'KO', 'K11', 'KS']: + if options.profile in ['KDX']: + options.format = 'CBZ' + elif options.profile in image.ProfileData.ProfilesKindle.keys(): options.format = 'MOBI' - elif options.profile in ['OTHER', 'KoMT', 'KoG', 'KoGHD', 'KoA', 'KoAHD', 'KoAH2O', 'KoAO', - 'KoN', 'KoC', 'KoCC', 'KoL', 'KoLC', 'KoF', 'KoS', 'KoE']: + else: options.format = 'EPUB' - elif options.profile in ['KDX']: - options.format = 'CBZ' - if options.profile in ['K1', 'K2', 'K34', 'K578', 'KPW', 'KPW5', 'KPW6', 'KCS12', 'KV', 'KO', 'K11', 'KS']: + if options.profile in image.ProfileData.ProfilesKindle.keys(): options.iskindle = True - elif options.profile in ['OTHER', 'KoMT', 'KoG', 'KoGHD', 'KoA', 'KoAHD', 'KoAH2O', 'KoAO', 'KoN', 'KoC', 'KoCC', 'KoL', 'KoLC', 'KoF', 'KoS', 'KoE']: + else: options.isKobo = True # Other Kobo devices probably support synthetic spreads as well, but # they haven't been tested. diff --git a/kindlecomicconverter/image.py b/kindlecomicconverter/image.py index c867280b..490bfef5 100755 --- a/kindlecomicconverter/image.py +++ b/kindlecomicconverter/image.py @@ -78,7 +78,7 @@ def __init__(self): PalleteNull = [ ] - Profiles = { + ProfilesKindle = { 'K1': ("Kindle 1", (600, 670), Palette4, 1.8), 'K11': ("Kindle 11/12", (1072, 1448), Palette16, 1.8), 'K2': ("Kindle 2", (600, 670), Palette15, 1.8), @@ -92,6 +92,9 @@ def __init__(self): 'KCS12': ("Kindle Colorsoft", (1264, 1680), Palette16, 1.8), 'KO': ("Kindle Oasis 2/3", (1264, 1680), Palette16, 1.8), 'KS': ("Kindle Scribe", (1860, 2480), Palette16, 1.8), + } + + ProfilesKobo = { 'KoMT': ("Kobo Mini/Touch", (600, 800), Palette16, 1.8), 'KoG': ("Kobo Glo", (768, 1024), Palette16, 1.8), 'KoGHD': ("Kobo Glo HD", (1072, 1448), Palette16, 1.8), @@ -107,6 +110,11 @@ def __init__(self): 'KoF': ("Kobo Forma", (1440, 1920), Palette16, 1.8), 'KoS': ("Kobo Sage", (1440, 1920), Palette16, 1.8), 'KoE': ("Kobo Elipsa", (1404, 1872), Palette16, 1.8), + } + + Profiles = { + **ProfilesKindle, + **ProfilesKobo, 'OTHER': ("Other", (0, 0), Palette16, 1.8), } From 0cee05b78b8ee67f148a5a110c51b0b69616e9d8 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Fri, 1 Nov 2024 09:28:37 -0700 Subject: [PATCH 2/5] put pw12 under oasis profile --- kindlecomicconverter/KCC_gui.py | 4 ++-- kindlecomicconverter/comic2ebook.py | 3 +-- kindlecomicconverter/image.py | 8 +++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py index 64f7337c..bfa1e1a1 100644 --- a/kindlecomicconverter/KCC_gui.py +++ b/kindlecomicconverter/KCC_gui.py @@ -935,10 +935,10 @@ def __init__(self, kccapp, kccwindow): 'PVOptions': True, 'ForceExpert': False, 'DefaultFormat': 0, 'DefaultUpscale': True, 'ForceColor': False, 'Label': 'KPW5', }, "Kindle PW 12": { - 'PVOptions': True, 'ForceExpert': False, 'DefaultFormat': 0, 'DefaultUpscale': True, 'ForceColor': False, 'Label': 'KPW6', + 'PVOptions': True, 'ForceExpert': False, 'DefaultFormat': 0, 'DefaultUpscale': True, 'ForceColor': False, 'Label': 'KO', }, "Kindle CS 12": { - 'PVOptions': True, 'ForceExpert': False, 'DefaultFormat': 0, 'DefaultUpscale': True, 'ForceColor': True, 'Label': 'KCS12', + 'PVOptions': True, 'ForceExpert': False, 'DefaultFormat': 0, 'DefaultUpscale': True, 'ForceColor': True, 'Label': 'KO', }, "Kindle PW 7/10": {'PVOptions': True, 'ForceExpert': False, 'DefaultFormat': 0, 'DefaultUpscale': True, 'ForceColor': False, 'Label': 'KV'}, diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index 66f911d1..b236e953 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -957,8 +957,7 @@ def makeParser(): help="Full path to comic folder or file(s) to be processed.") main_options.add_argument("-p", "--profile", action="store", dest="profile", default="KV", - help="Device profile (Available options: K1, K2, K34, K578, KDX, KPW, KPW5, KPW6, KCS12, KV, KO, " - "K11, KS, KoMT, KoG, KoGHD, KoA, KoAHD, KoAH2O, KoAO, KoN, KoC, KoCC, KoL, KoLC, KoF, KoS, KoE)" + help=f"Device profile (Available options: {', '.join(image.ProfileData.Profiles.keys())})" " [Default=KV]") main_options.add_argument("-m", "--manga-style", action="store_true", dest="righttoleft", default=False, help="Manga style (right-to-left reading and splitting)") diff --git a/kindlecomicconverter/image.py b/kindlecomicconverter/image.py index 490bfef5..527c4702 100755 --- a/kindlecomicconverter/image.py +++ b/kindlecomicconverter/image.py @@ -80,17 +80,15 @@ def __init__(self): ProfilesKindle = { 'K1': ("Kindle 1", (600, 670), Palette4, 1.8), - 'K11': ("Kindle 11/12", (1072, 1448), Palette16, 1.8), 'K2': ("Kindle 2", (600, 670), Palette15, 1.8), + 'KDX': ("Kindle DX/DXG", (824, 1000), Palette16, 1.8), 'K34': ("Kindle Keyboard/Touch", (600, 800), Palette16, 1.8), 'K578': ("Kindle", (600, 800), Palette16, 1.8), - 'KDX': ("Kindle DX/DXG", (824, 1000), Palette16, 1.8), 'KPW': ("Kindle Paperwhite 1/2", (758, 1024), Palette16, 1.8), 'KV': ("Kindle Paperwhite 3/4/Voyage/Oasis", (1072, 1448), Palette16, 1.8), + 'KO': ("Kindle Oasis 2/3/Paperwhite 6/Colorsoft 12", (1264, 1680), Palette16, 1.8), + 'K11': ("Kindle 11/12", (1072, 1448), Palette16, 1.8), 'KPW5': ("Kindle Paperwhite 5/Signature Edition", (1236, 1648), Palette16, 1.8), - 'KPW6': ("Kindle Paperwhite 6", (1264, 1680), Palette16, 1.8), - 'KCS12': ("Kindle Colorsoft", (1264, 1680), Palette16, 1.8), - 'KO': ("Kindle Oasis 2/3", (1264, 1680), Palette16, 1.8), 'KS': ("Kindle Scribe", (1860, 2480), Palette16, 1.8), } From 04985b4a8a765fa164c76c0d3225fbb00d972b90 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Mon, 4 Nov 2024 14:14:38 -0800 Subject: [PATCH 3/5] remove kindle 12 tag --- kindlecomicconverter/KCC_gui.py | 2 +- kindlecomicconverter/image.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py index bfa1e1a1..a7311cf3 100644 --- a/kindlecomicconverter/KCC_gui.py +++ b/kindlecomicconverter/KCC_gui.py @@ -928,7 +928,7 @@ def __init__(self, kccapp, kccwindow): "Kindle Scribe": { 'PVOptions': True, 'ForceExpert': False, 'DefaultFormat': 0, 'DefaultUpscale': False, 'ForceColor': False, 'Label': 'KS', }, - "Kindle 11/12": { + "Kindle 11": { 'PVOptions': True, 'ForceExpert': False, 'DefaultFormat': 0, 'DefaultUpscale': True, 'ForceColor': False, 'Label': 'K11', }, "Kindle PW 11": { diff --git a/kindlecomicconverter/image.py b/kindlecomicconverter/image.py index 527c4702..17e4d6f4 100755 --- a/kindlecomicconverter/image.py +++ b/kindlecomicconverter/image.py @@ -87,7 +87,7 @@ def __init__(self): 'KPW': ("Kindle Paperwhite 1/2", (758, 1024), Palette16, 1.8), 'KV': ("Kindle Paperwhite 3/4/Voyage/Oasis", (1072, 1448), Palette16, 1.8), 'KO': ("Kindle Oasis 2/3/Paperwhite 6/Colorsoft 12", (1264, 1680), Palette16, 1.8), - 'K11': ("Kindle 11/12", (1072, 1448), Palette16, 1.8), + 'K11': ("Kindle 11", (1072, 1448), Palette16, 1.8), 'KPW5': ("Kindle Paperwhite 5/Signature Edition", (1236, 1648), Palette16, 1.8), 'KS': ("Kindle Scribe", (1860, 2480), Palette16, 1.8), } From bfbf726d12f2cac7e5784347fe0b9dba6b4a2fd0 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Mon, 4 Nov 2024 19:31:54 -0800 Subject: [PATCH 4/5] separate ebok and pdoc --- README.md | 6 ++---- kindlecomicconverter/KCC_gui.py | 6 +++--- kindlecomicconverter/image.py | 12 ++++++++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d98da76a..2d7c8b1a 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ sudo apt-get install python3 p7zip-full python3-pil python3-psutil python3-slugi ``` 'K1': ("Kindle 1", (600, 670), Palette4, 1.8), - 'K11': ("Kindle 11/12", (1072, 1448), Palette16, 1.8), + 'K11': ("Kindle 11", (1072, 1448), Palette16, 1.8), 'K2': ("Kindle 2", (600, 670), Palette15, 1.8), 'K34': ("Kindle Keyboard/Touch", (600, 800), Palette16, 1.8), 'K578': ("Kindle", (600, 800), Palette16, 1.8), @@ -107,9 +107,7 @@ sudo apt-get install python3 p7zip-full python3-pil python3-psutil python3-slugi 'KPW': ("Kindle Paperwhite 1/2", (758, 1024), Palette16, 1.8), 'KV': ("Kindle Paperwhite 3/4/Voyage/Oasis", (1072, 1448), Palette16, 1.8), 'KPW5': ("Kindle Paperwhite 5/Signature Edition", (1236, 1648), Palette16, 1.8), - 'KPW6': ("Kindle Paperwhite 6", (1264, 1680), Palette16, 1.8), - 'KCS12': ("Kindle Colorsoft", (1264, 1680), Palette16, 1.8), - 'KO': ("Kindle Oasis 2/3", (1264, 1680), Palette16, 1.8), + 'KO': ("Kindle Oasis 2/3/Paperwhite 12/Colorsoft 12", (1264, 1680), Palette16, 1.8), 'KS': ("Kindle Scribe", (1860, 2480), Palette16, 1.8), 'KoMT': ("Kobo Mini/Touch", (600, 800), Palette16, 1.8), 'KoG': ("Kobo Glo", (768, 1024), Palette16, 1.8), diff --git a/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py index a7311cf3..e6bd3e38 100644 --- a/kindlecomicconverter/KCC_gui.py +++ b/kindlecomicconverter/KCC_gui.py @@ -994,10 +994,11 @@ def __init__(self, kccapp, kccwindow): 'Label': 'OTHER'}, } profilesGUI = [ - "Kindle Scribe", - "Kindle 11/12", "Kindle PW 12", "Kindle CS 12", + "Kindle Scribe", + "Kindle PW 11", + "Kindle 11", "Kindle Oasis 9/10", "Separator", "Kobo Clara 2E", @@ -1010,7 +1011,6 @@ def __init__(self, kccapp, kccwindow): "Separator", "Other", "Separator", - "Kindle PW 11", "Kindle Oasis 8", "Kindle PW 7/10", "Kindle Voyage", diff --git a/kindlecomicconverter/image.py b/kindlecomicconverter/image.py index 17e4d6f4..4080e727 100755 --- a/kindlecomicconverter/image.py +++ b/kindlecomicconverter/image.py @@ -78,7 +78,7 @@ def __init__(self): PalleteNull = [ ] - ProfilesKindle = { + ProfilesKindleEBOK = { 'K1': ("Kindle 1", (600, 670), Palette4, 1.8), 'K2': ("Kindle 2", (600, 670), Palette15, 1.8), 'KDX': ("Kindle DX/DXG", (824, 1000), Palette16, 1.8), @@ -86,12 +86,20 @@ def __init__(self): 'K578': ("Kindle", (600, 800), Palette16, 1.8), 'KPW': ("Kindle Paperwhite 1/2", (758, 1024), Palette16, 1.8), 'KV': ("Kindle Paperwhite 3/4/Voyage/Oasis", (1072, 1448), Palette16, 1.8), - 'KO': ("Kindle Oasis 2/3/Paperwhite 6/Colorsoft 12", (1264, 1680), Palette16, 1.8), + } + + ProfilesKindlePDOC = { + 'KO': ("Kindle Oasis 2/3/Paperwhite 12/Colorsoft 12", (1264, 1680), Palette16, 1.8), 'K11': ("Kindle 11", (1072, 1448), Palette16, 1.8), 'KPW5': ("Kindle Paperwhite 5/Signature Edition", (1236, 1648), Palette16, 1.8), 'KS': ("Kindle Scribe", (1860, 2480), Palette16, 1.8), } + ProfilesKindle = { + **ProfilesKindleEBOK, + **ProfilesKindlePDOC + } + ProfilesKobo = { 'KoMT': ("Kobo Mini/Touch", (600, 800), Palette16, 1.8), 'KoG': ("Kobo Glo", (768, 1024), Palette16, 1.8), From eea1be9b88f2ca91b060059bf4341c76990d96e3 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Mon, 4 Nov 2024 19:36:36 -0800 Subject: [PATCH 5/5] put cs 12 on top --- kindlecomicconverter/KCC_gui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py index e6bd3e38..880ca0be 100644 --- a/kindlecomicconverter/KCC_gui.py +++ b/kindlecomicconverter/KCC_gui.py @@ -994,8 +994,8 @@ def __init__(self, kccapp, kccwindow): 'Label': 'OTHER'}, } profilesGUI = [ - "Kindle PW 12", "Kindle CS 12", + "Kindle PW 12", "Kindle Scribe", "Kindle PW 11", "Kindle 11",