View Single Post
Old 06-17-2025, 02:50 PM   #10
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,465
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
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
chaley is offline   Reply With Quote