View Single Post
Old 05-31-2015, 10:30 PM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,388
Karma: 27756918
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Just FYI, this would be five lines of code if you were making a plugin for the calibre editor (not counting the boilerplate for the plugin)

Code:
    from calibre.ebooks.oeb.polish.replace import rename_files
    book = self.current_container
    fmap = {f:f.replace(' ', '_') for f in book.manifest_id_map.itervalues() if ' ' in f}
    if fmap:
        rename_files(book, fmap)
Just replace the call to self.magnify_fonts() with the above code in the demo plugin http://manual.calibre-ebook.com/crea...t-book-plugins

and you are done.

Last edited by kovidgoyal; 05-31-2015 at 11:17 PM.
kovidgoyal is offline   Reply With Quote