Allow for azw and azw3 files to be "sent" to kindle - these books are actually converted to mobi first
This commit is contained in:
bodybybuddha 2018-10-01 15:35:51 -04:00
parent 1144d97bc1
commit 46b2c9919a

View File

@ -185,6 +185,10 @@ def send_mail(book_id, kindle_mail, calibrepath, user_id):
formats["epub"] = entry.name + ".epub" formats["epub"] = entry.name + ".epub"
if entry.format == "PDF": if entry.format == "PDF":
formats["pdf"] = entry.name + ".pdf" formats["pdf"] = entry.name + ".pdf"
if entry.format == "AZW":
formats["azw"] = entry.name + ".azw"
if entry.format == "AZW3":
formats["azw3"] = entry.name + ".azw3"
if len(formats) == 0: if len(formats) == 0:
return _(u"Could not find any formats suitable for sending by e-mail") return _(u"Could not find any formats suitable for sending by e-mail")
@ -194,6 +198,12 @@ def send_mail(book_id, kindle_mail, calibrepath, user_id):
elif 'epub' in formats: elif 'epub' in formats:
# returns None if sucess, otherwise errormessage # returns None if sucess, otherwise errormessage
return convert_book_format(book_id, calibrepath, u'epub', u'mobi', user_id, kindle_mail) return convert_book_format(book_id, calibrepath, u'epub', u'mobi', user_id, kindle_mail)
elif 'azw3' in formats:
# returns None if sucess, otherwise errormessage
return convert_book_format(book_id, calibrepath, u'azw3', u'mobi', user_id, kindle_mail)
elif 'azw' in formats:
# returns None if sucess, otherwise errormessage
return convert_book_format(book_id, calibrepath, u'azw', u'mobi', user_id, kindle_mail)
elif 'pdf' in formats: elif 'pdf' in formats:
result = formats['pdf'] # worker.get_attachment() result = formats['pdf'] # worker.get_attachment()
else: else: