Don't continue the conversion process with unconvertable books.

This commit is contained in:
John Schember 2009-05-05 20:34:59 -04:00
parent a418271f35
commit 6413208f37
2 changed files with 10 additions and 8 deletions

View File

@ -973,9 +973,10 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
def auto_convert(self, row_ids, on_card, format): def auto_convert(self, row_ids, on_card, format):
previous = self.library_view.currentIndex() previous = self.library_view.currentIndex()
jobs, changed = convert_single_ebook(self, self.library_view.model().db, row_ids, True) jobs, changed, bad = convert_single_ebook(self, self.library_view.model().db, row_ids, True)
if jobs == []: return if jobs == []: return
for func, args, desc, fmt, id, temp_files in jobs: for func, args, desc, fmt, id, temp_files in jobs:
if id not in bad:
job = self.job_manager.run_job(Dispatcher(self.book_auto_converted), job = self.job_manager.run_job(Dispatcher(self.book_auto_converted),
func, args=args, description=desc) func, args=args, description=desc)
self.conversion_jobs[job] = (temp_files, fmt, id, on_card) self.conversion_jobs[job] = (temp_files, fmt, id, on_card)
@ -1021,9 +1022,10 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
previous = self.library_view.currentIndex() previous = self.library_view.currentIndex()
rows = [x.row() for x in \ rows = [x.row() for x in \
self.library_view.selectionModel().selectedRows()] self.library_view.selectionModel().selectedRows()]
jobs, changed = convert_single_ebook(self, jobs, changed, bad = convert_single_ebook(self,
self.library_view.model().db, row_ids) self.library_view.model().db, row_ids)
for func, args, desc, fmt, id, temp_files in jobs: for func, args, desc, fmt, id, temp_files in jobs:
if id not in bad:
job = self.job_manager.run_job(Dispatcher(self.book_converted), job = self.job_manager.run_job(Dispatcher(self.book_converted),
func, args=args, description=desc) func, args=args, description=desc)
self.conversion_jobs[job] = (temp_files, fmt, id) self.conversion_jobs[job] = (temp_files, fmt, id)

View File

@ -33,7 +33,7 @@ def convert_single_ebook(parent, db, row_ids, auto_conversion=False):
if auto_conversion: if auto_conversion:
result = QDialog.Accepted result = QDialog.Accepted
else: else:
retult = d.exec_() result = d.exec_()
if result == QDialog.Accepted: if result == QDialog.Accepted:
mi = db.get_metadata(row_id, True) mi = db.get_metadata(row_id, True)
@ -67,7 +67,7 @@ def convert_single_ebook(parent, db, row_ids, auto_conversion=False):
msg = _('<p>Could not convert %d of %d books, because no suitable source format was found.<ul>%s</ul>')%(len(res), total, '\n'.join(res)) msg = _('<p>Could not convert %d of %d books, because no suitable source format was found.<ul>%s</ul>')%(len(res), total, '\n'.join(res))
warning_dialog(parent, _('Could not convert some books'), msg).exec_() warning_dialog(parent, _('Could not convert some books'), msg).exec_()
return jobs, changed return jobs, changed, bad
def convert_bulk_ebooks(*args): def convert_bulk_ebooks(*args):