Merge remote-tracking branch 'bbb/295---Send-AZW-to-Kindle'

Changed function for 295, azw3 is preferred format for sending to kindle
This commit is contained in:
Ozzieisaacs
2018-11-18 17:09:13 +01:00
4 changed files with 95 additions and 44 deletions
+2 -2
View File
@@ -71,7 +71,7 @@ def get_attachment(bookpath, filename):
file_ = open(os.path.join(calibrepath, bookpath, filename), 'rb')
data = file_.read()
file_.close()
except IOError:
except IOError as e:
web.app.logger.exception(e) # traceback.print_exc()
web.app.logger.error(u'The requested file could not be read. Maybe wrong permissions?')
return None
@@ -320,7 +320,7 @@ class WorkerThread(threading.Thread):
cur_book = web.db.session.query(web.db.Books).filter(web.db.Books.id == bookid).first()
if os.path.isfile(file_path + format_new_ext):
new_format = web.db.Data(name=cur_book.data[0].name,
book_format=self.queue[self.current]['settings']['new_book_format'],
book_format=self.queue[self.current]['settings']['new_book_format'].upper(),
book=bookid, uncompressed_size=os.path.getsize(file_path + format_new_ext))
cur_book.data.append(new_format)
web.db.session.commit()