|
|
@ -81,7 +81,7 @@ def make_mobi(book_id, calibrepath):
|
|
|
|
file_path = os.path.join(calibrepath, book.path, data.name)
|
|
|
|
file_path = os.path.join(calibrepath, book.path, data.name)
|
|
|
|
if os.path.exists(file_path + u".epub"):
|
|
|
|
if os.path.exists(file_path + u".epub"):
|
|
|
|
p = subprocess.Popen((kindlegen + " \"" + file_path + u".epub\" ").encode(sys.getfilesystemencoding()),
|
|
|
|
p = subprocess.Popen((kindlegen + " \"" + file_path + u".epub\" ").encode(sys.getfilesystemencoding()),
|
|
|
|
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
|
|
|
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
|
|
# Poll process for new output until finished
|
|
|
|
# Poll process for new output until finished
|
|
|
|
while True:
|
|
|
|
while True:
|
|
|
|
nextline = p.stdout.readline()
|
|
|
|
nextline = p.stdout.readline()
|
|
|
@ -252,7 +252,7 @@ def get_valid_filename(value, replace_whitespace=True):
|
|
|
|
value=value.replace(u'ß',u'ss')
|
|
|
|
value=value.replace(u'ß',u'ss')
|
|
|
|
value = unicodedata.normalize('NFKD', value)
|
|
|
|
value = unicodedata.normalize('NFKD', value)
|
|
|
|
re_slugify = re.compile('[\W\s-]', re.UNICODE)
|
|
|
|
re_slugify = re.compile('[\W\s-]', re.UNICODE)
|
|
|
|
if type(value) is str: #Python3 str, Python2 unicode
|
|
|
|
if isinstance(value, str): #Python3 str, Python2 unicode
|
|
|
|
value = re_slugify.sub('', value).strip()
|
|
|
|
value = re_slugify.sub('', value).strip()
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
value = unicode(re_slugify.sub('', value).strip())
|
|
|
|
value = unicode(re_slugify.sub('', value).strip())
|
|
|
|