1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-11-29 05:05:14 +00:00

Bugfix failed tasks can no longer aborted

Metdatabackup is done on startup if app mode is test
This commit is contained in:
Ozzie Isaacs
2023-02-25 16:31:48 +01:00
parent b28a2cc58c
commit 76b0411c33
4 changed files with 11 additions and 10 deletions

View File

@@ -22,8 +22,8 @@ from urllib.request import urlopen
from lxml import etree
from html import escape
from cps import config, db, fs, gdriveutils, logger, ub
from cps.services.worker import CalibreTask, STAT_CANCELLED, STAT_ENDED
from cps import config, db, gdriveutils, logger
from cps.services.worker import CalibreTask
from flask_babel import lazy_gettext as N_
OPF_NAMESPACE = "http://www.idpf.org/2007/opf"
@@ -74,7 +74,10 @@ class TaskBackupMetadata(CalibreTask):
def backup_metadata(self):
try:
metadata_backup = self.calibre_db.session.query(db.Metadata_Dirtied).all()
custom_columns = self.calibre_db.session.query(db.CustomColumns).order_by(db.CustomColumns.label).all()
custom_columns = (self.calibre_db.session.query(db.CustomColumns)
.filter(db.CustomColumns.mark_for_delete == 0)
.filter(db.CustomColumns.datatype.notin_(db.cc_exceptions))
.order_by(db.CustomColumns.label).all())
count = len(metadata_backup)
i = 0
for backup in metadata_backup:
@@ -226,11 +229,11 @@ class TaskBackupMetadata(CalibreTask):
# doc = etree.tostring(package, xml_declaration=True, encoding='utf-8', pretty_print=True) # .replace(b""", b""")
try:
with open(book_metadata_filepath, 'wb') as f:
# f.write(doc)
doc.write(f, xml_declaration=True, encoding='utf-8', pretty_print=True)
except Exception:
# ToDo: Folder not writeable error
pass
@property
def name(self):
return "Metadata backup"