1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-10-13 14:47:40 +00:00
Task table: Status column and task messages have been localized
	Cleaned up the use of the task fields 'typ' and 'type' to be taskType and taskMessage
This commit is contained in:
bodybybuddha
2018-10-03 15:58:37 -04:00
parent 54f8680058
commit ee686b5379
4 changed files with 62 additions and 46 deletions

View File

@@ -73,10 +73,10 @@ def convert_book_format(book_id, calibrepath, old_book_format, new_book_format,
# read settings and append converter task to queue
if kindle_mail:
settings = ub.get_mail_settings()
text = _(u"Convert: %(book)s" , book=book.title)
text = _(u"%(format)s: %(book)s", format=new_book_format, book=book.title)
else:
settings = dict()
text = _(u"Convert to %(format)s: %(book)s", format=new_book_format, book=book.title)
text = _(u"%(format)s: %(book)s", format=new_book_format, book=book.title)
settings['old_book_format'] = old_book_format
settings['new_book_format'] = new_book_format
global_WorkerThread.add_convert(file_path, book.id, user_id, text, settings, kindle_mail)
@@ -523,7 +523,7 @@ class Updater(threading.Thread):
logging.getLogger('cps.web').debug("Could not remove:" + item_path)
shutil.rmtree(source, ignore_errors=True)
def check_unrar(unrarLocation):
error = False
if os.path.exists(unrarLocation):
@@ -568,11 +568,13 @@ def get_current_version_info():
return {'hash': content[0], 'datetime': content[1]}
return False
def render_task_status(tasklist):
#helper function to apply localize status information in tasklist entries
renderedtasklist=list()
for task in tasklist:
# localize the task status
if isinstance( task['status'], int ):
if task['status'] == worker.STAT_WAITING:
task['status'] = _('Waiting')
@@ -583,8 +585,21 @@ def render_task_status(tasklist):
elif task['status'] == worker.STAT_FINISH_SUCCESS:
task['status'] = _('Finished')
else:
task['status'] = _('Unknown Status')
task['status'] = _('Unknown Status')
# localize the task type
if isinstance( task['taskType'], int ):
if task['taskType'] == worker.TASK_EMAIL:
task['taskMessage'] = _('EMAIL: ') + task['taskMessage']
elif task['taskType'] == worker.TASK_CONVERT:
task['taskMessage'] = _('CONVERT: ') + task['taskMessage']
elif task['taskType'] == worker.TASK_UPLOAD:
task['taskMessage'] = _('UPLOAD: ') + task['taskMessage']
elif task['taskType'] == worker.TASK_CONVERT_ANY:
task['taskMessage'] = _('CONVERT: ') + task['taskMessage']
else:
task['taskMessage'] = _('Unknown Task: ') + task['taskMessage']
renderedtasklist.append(task)
return renderedtasklist