mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-04-07 21:43:31 +02:00
Initialize mime in cli module
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import html
|
||||
import math
|
||||
import mimetypes
|
||||
import os
|
||||
import pkg_resources
|
||||
import re
|
||||
|
||||
from functools import partial
|
||||
@@ -11,18 +9,6 @@ from ebook_converter import constants_old
|
||||
from ebook_converter.ebooks.html_entities import html5_entities
|
||||
|
||||
|
||||
def init_mimetypes():
|
||||
mimetypes.init([pkg_resources.resource_filename('ebook_converter',
|
||||
'data/mime.types')])
|
||||
|
||||
|
||||
def guess_extension(*args, **kwargs):
|
||||
ext = mimetypes.guess_extension(*args, **kwargs)
|
||||
if not ext and args and args[0] == 'application/x-palmreader':
|
||||
ext = '.pdb'
|
||||
return ext
|
||||
|
||||
|
||||
def sanitize_file_name(name, substitute='_'):
|
||||
"""
|
||||
Sanitize the filename `name`. All invalid characters are replaced by
|
||||
|
||||
Reference in New Issue
Block a user