mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Progress reporting for gui conversion.
This commit is contained in:
parent
6368f86626
commit
0a67d84598
@ -9,8 +9,8 @@ import logging
|
||||
from calibre.ebooks.conversion.plumber import Plumber
|
||||
from calibre.utils.logging import Log
|
||||
|
||||
def gui_convert(input, output, recommendations):
|
||||
plumber = Plumber(input, output, Log())
|
||||
def gui_convert(input, output, recommendations, notification):
|
||||
plumber = Plumber(input, output, Log(), notification)
|
||||
plumber.merge_ui_recommendations(recommendations)
|
||||
|
||||
plumber.run()
|
||||
|
@ -16,21 +16,21 @@ from calibre.gui2.convert import load_specifics
|
||||
from calibre.gui2.convert.single import NoSupportedInputFormats
|
||||
from calibre.gui2.convert.single import Config as SingleConfig
|
||||
|
||||
def convert_single_ebook(parent, db, row_ids, auto_conversion=False, out_format=None):
|
||||
def convert_single_ebook(parent, db, book_ids, auto_conversion=False, out_format=None):
|
||||
changed = False
|
||||
jobs = []
|
||||
bad = []
|
||||
|
||||
total = len(row_ids)
|
||||
total = len(book_ids)
|
||||
if total == 0:
|
||||
return None, None, None
|
||||
parent.status_bar.showMessage(_('Starting conversion of %d books') % total, 2000)
|
||||
|
||||
for i, row_id in enumerate(row_ids):
|
||||
for i, book_id in enumerate(book_ids):
|
||||
temp_files = []
|
||||
|
||||
try:
|
||||
d = SingleConfig(parent, db, row_id, None, out_format)
|
||||
d = SingleConfig(parent, db, book_id, None, out_format)
|
||||
|
||||
if auto_conversion:
|
||||
result = QDialog.Accepted
|
||||
@ -38,8 +38,8 @@ def convert_single_ebook(parent, db, row_ids, auto_conversion=False, out_format=
|
||||
result = d.exec_()
|
||||
|
||||
if result == QDialog.Accepted:
|
||||
mi = db.get_metadata(row_id, True)
|
||||
in_file = db.format_abspath(row_id, d.input_format, True)
|
||||
mi = db.get_metadata(book_id, True)
|
||||
in_file = db.format_abspath(book_id, d.input_format, True)
|
||||
|
||||
out_file = PersistentTemporaryFile('.' + d.output_format)
|
||||
out_file.write(d.output_format)
|
||||
@ -50,11 +50,11 @@ def convert_single_ebook(parent, db, row_ids, auto_conversion=False, out_format=
|
||||
recs = cPickle.loads(d.recommendations)
|
||||
args = [in_file, out_file.name, recs]
|
||||
temp_files = [out_file]
|
||||
jobs.append(('gui_convert', args, desc, d.output_format.upper(), row_id, temp_files))
|
||||
jobs.append(('gui_convert', args, desc, d.output_format.upper(), book_id, temp_files))
|
||||
|
||||
changed = True
|
||||
except NoSupportedInputFormats:
|
||||
bad.append(row_id)
|
||||
bad.append(book_id)
|
||||
|
||||
if bad != []:
|
||||
res = []
|
||||
@ -67,7 +67,6 @@ def convert_single_ebook(parent, db, row_ids, auto_conversion=False, out_format=
|
||||
|
||||
return jobs, changed, bad
|
||||
|
||||
|
||||
def convert_bulk_ebooks(*args):
|
||||
pass
|
||||
#(fmt, parent, db, comics, others):
|
||||
|
@ -50,9 +50,8 @@ PARALLEL_FUNCS = {
|
||||
'ebook-convert' :
|
||||
('calibre.ebooks.conversion.cli', 'main', {}, None),
|
||||
|
||||
|
||||
'gui_convert' :
|
||||
('calibre.gui2.convert.gui_conversion', 'gui_convert', {}, None),
|
||||
('calibre.gui2.convert.gui_conversion', 'gui_convert', {}, 'notification'),
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user