View Single Post
Old 08-18-2015, 03:53 AM   #4
Georgy
Junior Member
Georgy began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2015
Device: ipad
Quote:
Originally Posted by kovidgoyal View Post
If you know how to program it should not be hard to wite a script that uses the check book infrastructure to auto-fix correctable errors and run it via calibre-debug

Something as simple as

Code:
from calibre.ebooks.oeb.polish.check.main import run_checks, fix_errors
from calibre.ebooks.oeb.polish.container import get_container

import sys
filepath = sys.argv[-1]
container = get_container(filepath, tweak_mode=True)
errors = run_checks(container)
if errors:
    print ('Found errors, trying to fix them')
    if fix_errors(container, errors):
        container.commit()
Thanks eschwartz, thanks kovidgoyal!

It is very useful information for me! I'm familiar with python, but not familiar with Calibre yet. Can you help me, or give me a link, that can explain, how to run this script in Calibre? Such a quick start to scripting.

Thanks again,
Georgy
Georgy is offline   Reply With Quote