View Single Post
Old 08-14-2018, 02:17 PM   #2
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Quote:
Originally Posted by Phssthpok View Post
And is there anything already in Calibre to do the flattening, rather than having to include the whole unidecode module in my plugin?
Off the top of my head I can't remember exactly what each of the following does, but if you download a copy of the calibre source code these functions may be helpful:

from calibre.utils.filenames import ascii_text
from calibre import sanitize_file_name_unicode
from calibre.ebooks.oeb.polish.check.parsing import make_filename_safe

I've used all of them at some point in various calibre plugins.
jackie_w is offline   Reply With Quote