mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Fix auto-convert specific format, converts correctly and adds correct data to library.
This commit is contained in:
parent
6a88a4989b
commit
c19bad9dd6
@ -566,13 +566,14 @@ class DeviceGUI(object):
|
||||
else:
|
||||
bad.append(self.library_view.model().db.title(id, index_is_id=True))
|
||||
else:
|
||||
if specific_format in available_output_formats():
|
||||
if specific_format in list(set(fmts).intersection(set(available_output_formats()))):
|
||||
auto.append(id)
|
||||
else:
|
||||
bad.append(self.library_view.model().db.title(id, index_is_id=True))
|
||||
|
||||
if auto != []:
|
||||
format = None
|
||||
format = specific_format if specific_format in list(set(fmts).intersection(set(available_output_formats()))) else None
|
||||
if not format:
|
||||
for fmt in fmts:
|
||||
if fmt in list(set(fmts).intersection(set(available_output_formats()))):
|
||||
format = fmt
|
||||
@ -776,18 +777,19 @@ class DeviceGUI(object):
|
||||
else:
|
||||
bad.append(self.library_view.model().db.title(id, index_is_id=True))
|
||||
else:
|
||||
if specific_format in available_output_formats():
|
||||
if specific_format in list(set(self.device_manager.device_class.settings().format_map).intersection(set(available_output_formats()))):
|
||||
auto.append(id)
|
||||
else:
|
||||
bad.append(self.library_view.model().db.title(id, index_is_id=True))
|
||||
|
||||
if auto != []:
|
||||
format = None
|
||||
format = specific_format if specific_format in list(set(self.device_manager.device_class.settings().format_map).intersection(set(available_output_formats()))) else None
|
||||
if not format:
|
||||
for fmt in self.device_manager.device_class.settings().format_map:
|
||||
if fmt in list(set(self.device_manager.device_class.settings().format_map).intersection(set(available_output_formats()))):
|
||||
format = fmt
|
||||
break
|
||||
if format is None:
|
||||
if not format:
|
||||
bad += auto
|
||||
else:
|
||||
autos = [self.library_view.model().db.title(id, index_is_id=True) for id in auto]
|
||||
|
@ -1186,7 +1186,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
||||
try:
|
||||
if job.failed:
|
||||
return self.job_exception(job)
|
||||
data = open(temp_files[0].name, 'rb')
|
||||
data = open(temp_files[-1].name, 'rb')
|
||||
self.library_view.model().db.add_format(book_id, fmt, data, index_is_id=True)
|
||||
data.close()
|
||||
self.status_bar.showMessage(job.description + (' completed'), 2000)
|
||||
@ -1210,7 +1210,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
||||
if job.failed:
|
||||
self.job_exception(job)
|
||||
return
|
||||
data = open(temp_files[0].name, 'rb')
|
||||
data = open(temp_files[-1].name, 'rb')
|
||||
self.library_view.model().db.add_format(book_id, fmt, data, index_is_id=True)
|
||||
data.close()
|
||||
self.status_bar.showMessage(job.description + (' completed'), 2000)
|
||||
@ -1233,7 +1233,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
||||
try:
|
||||
if job.failed:
|
||||
return self.job_exception(job)
|
||||
data = open(temp_files[0].name, 'rb')
|
||||
data = open(temp_files[-1].name, 'rb')
|
||||
self.library_view.model().db.add_format(book_id, fmt, data, index_is_id=True)
|
||||
data.close()
|
||||
self.status_bar.showMessage(job.description + (' completed'), 2000)
|
||||
|
Loading…
x
Reference in New Issue
Block a user