Remove convert task from db.py - with the fixed from #1565, this no longer seems to be needed

This commit is contained in:
blitzmann
2020-08-23 13:07:24 -04:00
parent 9ce2e8ea53
commit bf41b04cfa
2 changed files with 11 additions and 15 deletions
+11 -3
View File
@@ -6,6 +6,8 @@ import re
from glob import glob
from shutil import copyfile
from sqlalchemy.exc import SQLAlchemyError
from cps.services.worker import CalibreTask
from cps import calibre_db, db
from cps import logger, config
@@ -84,9 +86,15 @@ class TaskConvert(CalibreTask):
book=book_id, uncompressed_size=os.path.getsize(file_path + format_new_ext))
# todo: this may not be needed anymore, might be able to access the DB directly now. See #1565
task = {'task':'add_format','id': book_id, 'format': new_format}
self.worker_thread.db_queue.put(task)
# To Do how to handle error?
cur_book = calibre_db.session.query(db.Books).filter(db.Books.id == book_id).first()
cur_book.data.append(new_format)
try:
# db.session.merge(cur_book)
calibre_db.session.commit()
except SQLAlchemyError as e:
calibre_db.session.rollback()
log.error("Database error: %s", e)
'''cur_book.data.append(new_format)
try: