mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 01:36:27 +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:
@@ -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.
|
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,
|
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,
|
Its main feature is various optional image processing steps to look good on eink screens,
|
||||||
which have different requirements than normal LCD screens.
|
which have different requirements than normal LCD screens.
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ def buildNAV(dstdir, title, chapters, chapternames):
|
|||||||
f.close()
|
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')
|
opffile = os.path.join(dstdir, 'OEBPS', 'content.opf')
|
||||||
deviceres = options.profileData[1]
|
deviceres = options.profileData[1]
|
||||||
if options.righttoleft:
|
if options.righttoleft:
|
||||||
@@ -366,6 +366,11 @@ def buildOPF(dstdir, title, filelist, cover=None):
|
|||||||
else:
|
else:
|
||||||
f.write("</manifest>\n<spine page-progression-direction=\"ltr\" toc=\"ncx\">\n")
|
f.write("</manifest>\n<spine page-progression-direction=\"ltr\" toc=\"ncx\">\n")
|
||||||
pageside = "left"
|
pageside = "left"
|
||||||
|
if originalpath.lower().endswith('.pdf'):
|
||||||
|
if pageside == "right":
|
||||||
|
pageside = "left"
|
||||||
|
else:
|
||||||
|
pageside = "right"
|
||||||
if options.spreadshift:
|
if options.spreadshift:
|
||||||
if pageside == "right":
|
if pageside == "right":
|
||||||
pageside = "left"
|
pageside = "left"
|
||||||
@@ -440,7 +445,7 @@ def buildOPF(dstdir, title, filelist, cover=None):
|
|||||||
"</container>"])
|
"</container>"])
|
||||||
f.close()
|
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 = []
|
filelist = []
|
||||||
chapterlist = []
|
chapterlist = []
|
||||||
os.mkdir(os.path.join(path, 'OEBPS', 'Text'))
|
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]
|
chapternames[filename] = aChapter[1]
|
||||||
buildNCX(path, options.title, chapterlist, chapternames)
|
buildNCX(path, options.title, chapterlist, chapternames)
|
||||||
buildNAV(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):
|
def buildPDF(path, title, cover=None, output_file=None):
|
||||||
@@ -1579,10 +1584,10 @@ def makeBook(source, qtgui=None):
|
|||||||
else:
|
else:
|
||||||
print("Creating EPUB file...")
|
print("Creating EPUB file...")
|
||||||
if len(tomes) > 1:
|
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)))
|
filepath.append(getOutputFilename(source, options.output, '.epub', ' ' + str(tomeNumber)))
|
||||||
else:
|
else:
|
||||||
buildEPUB(tome, chapterNames, tomeNumber, False, cover)
|
buildEPUB(tome, chapterNames, tomeNumber, False, cover, source)
|
||||||
filepath.append(getOutputFilename(source, options.output, '.epub', ''))
|
filepath.append(getOutputFilename(source, options.output, '.epub', ''))
|
||||||
makeZIP(tome + '_comic', tome, True)
|
makeZIP(tome + '_comic', tome, True)
|
||||||
# Copy files to final destination (PDF files are already saved directly)
|
# Copy files to final destination (PDF files are already saved directly)
|
||||||
|
|||||||
Reference in New Issue
Block a user