Improved debug output for task added

Improved handling of calibre output on windows
This commit is contained in:
Ozzie Isaacs 2021-12-18 17:31:33 +01:00
parent 92f65882b2
commit 021298374e
3 changed files with 12 additions and 3 deletions

View File

@ -217,13 +217,16 @@ class TaskConvert(CalibreTask):
quotes.append(quotes_index)
quotes_index += 1
p = process_open(command, quotes)
p = process_open(command, quotes, newlines=False)
except OSError as e:
return 1, _(u"Ebook-converter failed: %(error)s", error=e)
while p.poll() is None:
nextline = p.stdout.readline()
log.debug(nextline.strip('\r\n'))
if isinstance(nextline, bytes):
nextline = nextline.decode('utf-8', errors="ignore").strip('\r\n')
if nextline:
log.debug(nextline)
# parse progress string from calibre-converter
progress = re.search(r"(\d+)%\s.*", nextline)
if progress:
@ -244,3 +247,6 @@ class TaskConvert(CalibreTask):
@property
def name(self):
return "Convert"
def __str__(self):
return "Convert {} {}".format(self.bookid, self.kindle_mail)

View File

@ -267,4 +267,4 @@ class TaskEmail(CalibreTask):
return "E-mail"
def __str__(self):
return "{}, {}".format(self.name, self.subject)
return "E-mail {}, {}".format(self.name, self.subject)

View File

@ -32,3 +32,6 @@ class TaskUpload(CalibreTask):
@property
def name(self):
return "Upload"
def __str__(self):
return "Upload {}".format(self.message)