1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-11 08:46:25 +00:00

PDF input: spreadshift behavior is inverted so Humble PDF's don't need to check it (#1082)

* pdf input: spreadshift behavior is inverted so Humble PDF's don't need to check it

* remove pdf spreadshift from readme
This commit is contained in:
Alex Xu
2025-09-11 13:25:36 -07:00
committed by GitHub
parent 420bed995b
commit 20388304e8
2 changed files with 11 additions and 6 deletions

View File

@@ -19,7 +19,7 @@ When using a reMarkable profile (Rmk1, Rmk2, RmkPP), the format automatically de
for optimal compatibility with your device's native PDF reader.
The absolute highest quality source files are print quality DRM-free PDFs from Kodansha/[Humble Bundle](https://humblebundleinc.sjv.io/xL6Zv1)/Fanatical,
which can be directly converted by KCC. Be sure to check the spread shift option!
which can be directly converted by KCC.
Its main feature is various optional image processing steps to look good on eink screens,
which have different requirements than normal LCD screens.

View File

@@ -278,7 +278,7 @@ def buildNAV(dstdir, title, chapters, chapternames):
f.close()
def buildOPF(dstdir, title, filelist, cover=None):
def buildOPF(dstdir, title, filelist, originalpath, cover=None):
opffile = os.path.join(dstdir, 'OEBPS', 'content.opf')
deviceres = options.profileData[1]
if options.righttoleft:
@@ -366,6 +366,11 @@ def buildOPF(dstdir, title, filelist, cover=None):
else:
f.write("</manifest>\n<spine page-progression-direction=\"ltr\" toc=\"ncx\">\n")
pageside = "left"
if originalpath.lower().endswith('.pdf'):
if pageside == "right":
pageside = "left"
else:
pageside = "right"
if options.spreadshift:
if pageside == "right":
pageside = "left"
@@ -440,7 +445,7 @@ def buildOPF(dstdir, title, filelist, cover=None):
"</container>"])
f.close()
def buildEPUB(path, chapternames, tomenumber, ischunked, cover: image.Cover, len_tomes=0):
def buildEPUB(path, chapternames, tomenumber, ischunked, cover: image.Cover, originalpath, len_tomes=0):
filelist = []
chapterlist = []
os.mkdir(os.path.join(path, 'OEBPS', 'Text'))
@@ -580,7 +585,7 @@ def buildEPUB(path, chapternames, tomenumber, ischunked, cover: image.Cover, len
chapternames[filename] = aChapter[1]
buildNCX(path, options.title, chapterlist, chapternames)
buildNAV(path, options.title, chapterlist, chapternames)
buildOPF(path, options.title, filelist, cover)
buildOPF(path, options.title, filelist, originalpath, cover)
def buildPDF(path, title, cover=None, output_file=None):
@@ -1579,10 +1584,10 @@ def makeBook(source, qtgui=None):
else:
print("Creating EPUB file...")
if len(tomes) > 1:
buildEPUB(tome, chapterNames, tomeNumber, True, cover, len(tomes))
buildEPUB(tome, chapterNames, tomeNumber, True, cover, source, len(tomes))
filepath.append(getOutputFilename(source, options.output, '.epub', ' ' + str(tomeNumber)))
else:
buildEPUB(tome, chapterNames, tomeNumber, False, cover)
buildEPUB(tome, chapterNames, tomeNumber, False, cover, source)
filepath.append(getOutputFilename(source, options.output, '.epub', ''))
makeZIP(tome + '_comic', tome, True)
# Copy files to final destination (PDF files are already saved directly)