1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-30 21:40:00 +00:00

Bugfix convert file from gdrive without cover

Update Teststatus
This commit is contained in:
Ozzie Isaacs 2023-12-10 07:26:26 +01:00
parent 1086296d1d
commit 9ef89dbcc3
2 changed files with 5783 additions and 499 deletions

View File

@ -66,15 +66,17 @@ class TaskConvert(CalibreTask):
df = gdriveutils.getFileFromEbooksFolder(cur_book.path, df = gdriveutils.getFileFromEbooksFolder(cur_book.path,
data.name + "." + self.settings['old_book_format'].lower()) data.name + "." + self.settings['old_book_format'].lower())
df_cover = gdriveutils.getFileFromEbooksFolder(cur_book.path, "cover.jpg") df_cover = gdriveutils.getFileFromEbooksFolder(cur_book.path, "cover.jpg")
if df and df_cover: if df:
datafile = os.path.join(config.config_calibre_dir, datafile = os.path.join(config.config_calibre_dir,
cur_book.path, cur_book.path,
data.name + "." + self.settings['old_book_format'].lower()) data.name + "." + self.settings['old_book_format'].lower())
if df_cover:
datafile_cover = os.path.join(config.config_calibre_dir, datafile_cover = os.path.join(config.config_calibre_dir,
cur_book.path, "cover.jpg") cur_book.path, "cover.jpg")
if not os.path.exists(os.path.join(config.config_calibre_dir, cur_book.path)): 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)) os.makedirs(os.path.join(config.config_calibre_dir, cur_book.path))
df.GetContentFile(datafile) df.GetContentFile(datafile)
if df_cover:
df_cover.GetContentFile(datafile_cover) df_cover.GetContentFile(datafile_cover)
worker_db.session.close() worker_db.session.close()
else: else:
@ -83,11 +85,12 @@ class TaskConvert(CalibreTask):
format=self.settings['old_book_format'], format=self.settings['old_book_format'],
fn=data.name + "." + self.settings['old_book_format'].lower()) fn=data.name + "." + self.settings['old_book_format'].lower())
worker_db.session.close() worker_db.session.close()
return error_message return self._handleError(self, error_message)
filename = self._convert_ebook_format() filename = self._convert_ebook_format()
if config.config_use_google_drive: if config.config_use_google_drive:
os.remove(self.file_path + '.' + self.settings['old_book_format'].lower()) os.remove(self.file_path + '.' + self.settings['old_book_format'].lower())
if df_cover:
os.remove(os.path.join(config.config_calibre_dir, cur_book.path, "cover.jpg")) os.remove(os.path.join(config.config_calibre_dir, cur_book.path, "cover.jpg"))
if filename: if filename:
@ -254,7 +257,7 @@ class TaskConvert(CalibreTask):
command = [config.config_converterpath, (file_path + format_old_ext), command = [config.config_converterpath, (file_path + format_old_ext),
(file_path + format_new_ext)] (file_path + format_new_ext)]
if config.config_embed_metadata: if config.config_embed_metadata:
command.extend('--from-opf', path_tmp_opf) command.extend(['--from-opf', path_tmp_opf])
if has_cover: if has_cover:
command.extend(['--cover', os.path.join(os.path.dirname(file_path), 'cover.jpg')]) command.extend(['--cover', os.path.join(os.path.dirname(file_path), 'cover.jpg')])
quotes_index = 3 quotes_index = 3

File diff suppressed because it is too large Load Diff