From 6f26bd58740ea57737f5a8bff86c979d63f40b14 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Wed, 15 Apr 2026 17:22:00 -0700 Subject: [PATCH] add epub series metadata (#1294) --- kindlecomicconverter/comic2ebook.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index 79e1e4f..59a1408 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -310,6 +310,15 @@ def buildOPF(dstdir, title, filelist, originalpath, cover=None): f.writelines(["", hescape(options.summary), "\n"]) for author in options.authors: f.writelines(["", hescape(author), "\n"]) + if not options.iskindle and options.series: + f.writelines(['', hescape(options.series), "\n"]) + f.writelines(['', "series", "\n"]) + if options.volume and options.number: + f.writelines(['', hescape(f"{options.volume}.{options.number}"), "\n"]) + elif options.volume: + f.writelines(['', hescape(options.volume), "\n"]) + elif options.number: + f.writelines(['', hescape(options.number), "\n"]) f.write("" + strftime("%Y-%m-%dT%H:%M:%SZ", gmtime()) + "\n") if cover: f.write("\n") @@ -992,6 +1001,9 @@ def getMetadata(path, originalpath): options.comicinfo_chapters = [] options.summary = '' titleSuffix = '' + options.volume = '' + options.number = '' + options.series = '' if options.title == 'defaulttitle': defaultTitle = True if os.path.isdir(originalpath): @@ -1020,8 +1032,10 @@ def getMetadata(path, originalpath): options.title = xml.data['Series'] if xml.data['Volume']: titleSuffix += ' Vol. ' + xml.data['Volume'].zfill(2) + options.volume = xml.data['Volume'] if xml.data['Number']: titleSuffix += ' #' + xml.data['Number'].zfill(3) + options.number = xml.data['Number'] if options.metadatatitle == 1 and xml.data['Title']: titleSuffix += ': ' + xml.data['Title'] options.title += titleSuffix @@ -1039,6 +1053,8 @@ def getMetadata(path, originalpath): options.comicinfo_chapters = xml.data['Bookmarks'] if xml.data['Summary']: options.summary = xml.data['Summary'] + if xml.data['Series']: + options.series = xml.data['Series'] os.remove(xmlPath) if originalpath.lower().endswith('.pdf'):