1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-28 12:30:00 +00:00

Fixes for failed email and conversions with gdrive

This commit is contained in:
Ozzieisaacs 2020-10-04 13:59:33 +02:00
parent eb37e3a52b
commit e3f4f24c3e
3 changed files with 8 additions and 7 deletions

View File

@ -210,7 +210,7 @@ class CalibreTask:
self._progress = x self._progress = x
def _handleError(self, error_message): def _handleError(self, error_message):
log.error(error_message) log.exception(error_message)
self.stat = STAT_FAIL self.stat = STAT_FAIL
self.progress = 1 self.progress = 1
self.error = error_message self.error = error_message

View File

@ -51,6 +51,8 @@ class TaskConvert(CalibreTask):
return error_message return error_message
filename = self._convert_ebook_format() filename = self._convert_ebook_format()
if config.config_use_google_drive:
os.remove(self.file_path + u'.' + self.settings['old_book_format'].lower())
if filename: if filename:
if config.config_use_google_drive: if config.config_use_google_drive:
@ -117,9 +119,7 @@ class TaskConvert(CalibreTask):
return return
self.results['path'] = cur_book.path self.results['path'] = cur_book.path
self.results['title'] = cur_book.title self.results['title'] = cur_book.title
if config.config_use_google_drive: if not config.config_use_google_drive:
os.remove(file_path + format_old_ext)
else:
self._handleSuccess() self._handleSuccess()
return os.path.basename(file_path + format_new_ext) return os.path.basename(file_path + format_new_ext)
else: else:

View File

@ -169,7 +169,7 @@ class TaskEmail(CalibreTask):
except (MemoryError) as e: except (MemoryError) as e:
log.exception(e) log.exception(e)
self._handleError(u'MemoryError sending email: ' + str(e)) self._handleError(u'MemoryError sending email: ' + str(e))
return None # return None
except (smtplib.SMTPException, smtplib.SMTPAuthenticationError) as e: except (smtplib.SMTPException, smtplib.SMTPAuthenticationError) as e:
if hasattr(e, "smtp_error"): if hasattr(e, "smtp_error"):
text = e.smtp_error.decode('utf-8').replace("\n", '. ') text = e.smtp_error.decode('utf-8').replace("\n", '. ')
@ -181,10 +181,11 @@ class TaskEmail(CalibreTask):
log.exception(e) log.exception(e)
text = '' text = ''
self._handleError(u'Smtplib Error sending email: ' + text) self._handleError(u'Smtplib Error sending email: ' + text)
return None # return None
except (socket.error) as e: except (socket.error) as e:
self._handleError(u'Socket Error sending email: ' + e.strerror) self._handleError(u'Socket Error sending email: ' + e.strerror)
return None # return None
@property @property
def progress(self): def progress(self):