Fix UI Deelete Buttons in Edit Books page
Fix Conversion of multiple formats of one book in the queue with gdrive
This commit is contained in:
+24
-1
@@ -32,11 +32,31 @@ class TaskConvert(CalibreTask):
|
||||
|
||||
def run(self, worker_thread):
|
||||
self.worker_thread = worker_thread
|
||||
if config.config_use_google_drive:
|
||||
cur_book = calibre_db.get_book(self.bookid)
|
||||
data = calibre_db.get_book_format(self.bookid, self.settings['old_book_format'])
|
||||
df = gdriveutils.getFileFromEbooksFolder(cur_book.path,
|
||||
data.name + "." + self.settings['old_book_format'].lower())
|
||||
if df:
|
||||
datafile = os.path.join(config.config_calibre_dir,
|
||||
cur_book.path,
|
||||
data.name + u"." + self.settings['old_book_format'].lower())
|
||||
if not os.path.exists(os.path.join(config.config_calibre_dir, cur_book.path)):
|
||||
os.makedirs(os.path.join(config.config_calibre_dir, cur_book.path))
|
||||
df.GetContentFile(datafile)
|
||||
else:
|
||||
error_message = _(u"%(format)s not found on Google Drive: %(fn)s",
|
||||
format=self.settings['old_book_format'],
|
||||
fn=data.name + "." + self.settings['old_book_format'].lower())
|
||||
return error_message
|
||||
|
||||
filename = self._convert_ebook_format()
|
||||
|
||||
if filename:
|
||||
if config.config_use_google_drive:
|
||||
# Upload files to gdrive
|
||||
gdriveutils.updateGdriveCalibreFromLocal()
|
||||
self._handleSuccess()
|
||||
if self.kindle_mail:
|
||||
# if we're sending to kindle after converting, create a one-off task and run it immediately
|
||||
# todo: figure out how to incorporate this into the progress
|
||||
@@ -99,7 +119,8 @@ class TaskConvert(CalibreTask):
|
||||
self.results['title'] = cur_book.title
|
||||
if config.config_use_google_drive:
|
||||
os.remove(file_path + format_old_ext)
|
||||
self._handleSuccess()
|
||||
else:
|
||||
self._handleSuccess()
|
||||
return os.path.basename(file_path + format_new_ext)
|
||||
else:
|
||||
error_message = _('%(format)s format not found on disk', format=format_new_ext.upper())
|
||||
@@ -175,6 +196,8 @@ class TaskConvert(CalibreTask):
|
||||
progress = re.search(r"(\d+)%\s.*", nextline)
|
||||
if progress:
|
||||
self.progress = int(progress.group(1)) / 100
|
||||
if config.config_use_google_drive:
|
||||
self.progress *= 0.9
|
||||
|
||||
# process returncode
|
||||
check = p.returncode
|
||||
|
||||
Reference in New Issue
Block a user