Merge branch 'Develop' into metadata -> Now all tests should run "pass" now

# Conflicts:
#	cps/constants.py
#	cps/helper.py
#	cps/tasks/convert.py
#	test/Calibre-Web TestSummary_Linux.html
This commit is contained in:
Ozzie Isaacs
2023-12-11 14:23:12 +01:00
79 changed files with 4922 additions and 1020 deletions

9
cps/tasks/convert.py Executable file → Normal file
View File

@@ -49,7 +49,6 @@ class TaskConvert(CalibreTask):
self.file_path = file_path
self.book_id = book_id
self.title = ""
self.has_cover = None
self.settings = settings
self.ereader_mail = ereader_mail
self.user = user
@@ -67,14 +66,14 @@ class TaskConvert(CalibreTask):
data.name + "." + self.settings['old_book_format'].lower())
df_cover = gdriveutils.getFileFromEbooksFolder(cur_book.path, "cover.jpg")
if df:
datafile = os.path.join(config.config_calibre_dir,
datafile = os.path.join(config.get_book_path(),
cur_book.path,
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.get_book_path(),
cur_book.path, "cover.jpg")
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))
if not os.path.exists(os.path.join(config.get_book_path(), cur_book.path)):
os.makedirs(os.path.join(config.get_book_path(), cur_book.path))
df.GetContentFile(datafile)
if df_cover:
df_cover.GetContentFile(datafile_cover)

2
cps/tasks/mail.py Executable file → Normal file
View File

@@ -239,7 +239,7 @@ class TaskEmail(CalibreTask):
@classmethod
def _get_attachment(cls, book_path, filename):
"""Get file as MIMEBase message"""
calibre_path = config.config_calibre_dir
calibre_path = config.get_book_path()
if config.config_use_google_drive:
df = gdriveutils.getFileFromEbooksFolder(book_path, filename)
if df:

View File

@@ -114,7 +114,7 @@ class TaskBackupMetadata(CalibreTask):
True)
else:
# ToDo: Handle book folder not found or not readable
book_metadata_filepath = os.path.join(config.config_calibre_dir, book.path, 'metadata.opf')
book_metadata_filepath = os.path.join(config.get_book_path(), book.path, 'metadata.opf')
# prepare finalize everything and output
doc = etree.ElementTree(package)
try:

View File

@@ -209,7 +209,7 @@ class TaskGenerateCoverThumbnails(CalibreTask):
if stream is not None:
stream.close()
else:
book_cover_filepath = os.path.join(config.config_calibre_dir, book.path, 'cover.jpg')
book_cover_filepath = os.path.join(config.get_book_path(), book.path, 'cover.jpg')
if not os.path.isfile(book_cover_filepath):
raise Exception('Book cover file not found')
@@ -404,7 +404,7 @@ class TaskGenerateSeriesThumbnails(CalibreTask):
if stream is not None:
stream.close()
book_cover_filepath = os.path.join(config.config_calibre_dir, book.path, 'cover.jpg')
book_cover_filepath = os.path.join(config.get_book_path(), book.path, 'cover.jpg')
if not os.path.isfile(book_cover_filepath):
raise Exception('Book cover file not found')