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
def _handleError(self, error_message):
log.error(error_message)
log.exception(error_message)
self.stat = STAT_FAIL
self.progress = 1
self.error = error_message

View File

@ -51,6 +51,8 @@ class TaskConvert(CalibreTask):
return error_message
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 config.config_use_google_drive:
@ -117,9 +119,7 @@ class TaskConvert(CalibreTask):
return
self.results['path'] = cur_book.path
self.results['title'] = cur_book.title
if config.config_use_google_drive:
os.remove(file_path + format_old_ext)
else:
if not config.config_use_google_drive:
self._handleSuccess()
return os.path.basename(file_path + format_new_ext)
else:

View File

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