Here is a python script that kepubifies epubs in a directory then removes the underlying epub. It is basic, for example missing setting up options.
Code:
from calibre.ebooks.oeb.polish.kepubify import kepubify_path
import os
books_dir = sys.argv[1]
for root, dirs, files in os.walk(books_dir):
for f in files:
base, ext = os.path.splitext(f)
if ext == '.epub' and not base.endswith('kepub'):
infile = os.path.join(root, f)
outfile = os.path.join(root, base+'.kepub'+ext)
print(infile, outfile)
kepubify_path(infile, outfile)
os.remove(infile)
It is called with
Code:
calibre-debug -e kepub.py full_path_to_directory