mirror of
https://github.com/ciromattia/kcc
synced 2026-07-11 15:33:17 +00:00
preserve ComicInfo.xml in CBZ output for Other profile
This commit is contained in:
@@ -1103,6 +1103,7 @@ def getOutputFilename(srcpath, wantedname, ext, tomenumber):
|
|||||||
def getMetadata(path, originalpath):
|
def getMetadata(path, originalpath):
|
||||||
xmlPath = os.path.join(path, 'ComicInfo.xml')
|
xmlPath = os.path.join(path, 'ComicInfo.xml')
|
||||||
options.comicinfo_chapters = []
|
options.comicinfo_chapters = []
|
||||||
|
options.comicinfo_xml = None
|
||||||
options.summary = ''
|
options.summary = ''
|
||||||
titleSuffix = ''
|
titleSuffix = ''
|
||||||
options.volume = ''
|
options.volume = ''
|
||||||
@@ -1159,6 +1160,10 @@ def getMetadata(path, originalpath):
|
|||||||
options.summary = xml.data['Summary']
|
options.summary = xml.data['Summary']
|
||||||
if xml.data['Series']:
|
if xml.data['Series']:
|
||||||
options.series = xml.data['Series']
|
options.series = xml.data['Series']
|
||||||
|
# ComicInfo.xml in output may break old Kindles and Kobos, keep only for OTHER profile
|
||||||
|
if options.isOther and options.format == 'CBZ':
|
||||||
|
with open(xmlPath, 'rb') as f:
|
||||||
|
options.comicinfo_xml = f.read()
|
||||||
os.remove(xmlPath)
|
os.remove(xmlPath)
|
||||||
|
|
||||||
if originalpath.lower().endswith('.pdf'):
|
if originalpath.lower().endswith('.pdf'):
|
||||||
@@ -1585,6 +1590,8 @@ def checkOptions(options):
|
|||||||
options.iskindle = True
|
options.iskindle = True
|
||||||
else:
|
else:
|
||||||
options.isKobo = True
|
options.isKobo = True
|
||||||
|
# remember before custom width/height overrides profile to 'Custom'
|
||||||
|
options.isOther = options.profile == 'OTHER'
|
||||||
|
|
||||||
if options.lightnovel:
|
if options.lightnovel:
|
||||||
options.noKepub = True
|
options.noKepub = True
|
||||||
@@ -1905,6 +1912,9 @@ def makeBook(source, qtgui=None, job_progress=''):
|
|||||||
filepath.append(getOutputFilename(source, options.output, '.cbz', ''))
|
filepath.append(getOutputFilename(source, options.output, '.cbz', ''))
|
||||||
if cover and cover.smartcover:
|
if cover and cover.smartcover:
|
||||||
cover.save_to_folder(os.path.join(tome, 'OEBPS', 'Images', '##cover.jpg'), tomeNumber, len(tomes))
|
cover.save_to_folder(os.path.join(tome, 'OEBPS', 'Images', '##cover.jpg'), tomeNumber, len(tomes))
|
||||||
|
if options.comicinfo_xml:
|
||||||
|
with open(os.path.join(tome, 'OEBPS', 'Images', 'ComicInfo.xml'), 'wb') as xmlOutput:
|
||||||
|
xmlOutput.write(options.comicinfo_xml)
|
||||||
makeZIP(filepath[-1], os.path.join(tome, "OEBPS", "Images"), job_progress)
|
makeZIP(filepath[-1], os.path.join(tome, "OEBPS", "Images"), job_progress)
|
||||||
elif options.format == 'PDF':
|
elif options.format == 'PDF':
|
||||||
print(f"{job_progress}Creating PDF file with PyMuPDF...")
|
print(f"{job_progress}Creating PDF file with PyMuPDF...")
|
||||||
|
|||||||
Reference in New Issue
Block a user