Bugfixes after testrun

This commit is contained in:
Ozzie Isaacs 2022-04-28 20:57:09 +02:00
parent aaa749933d
commit a968ddaef2
4 changed files with 2112 additions and 1033 deletions

View File

@ -166,6 +166,11 @@ def create_app():
config.config_goodreads_api_secret, config.config_goodreads_api_secret,
config.config_use_goodreads) config.config_use_goodreads)
config.store_calibre_uuid(calibre_db, db.Library_Id) config.store_calibre_uuid(calibre_db, db.Library_Id)
# Register scheduled tasks
from .schedule import register_scheduled_tasks, register_startup_tasks
register_scheduled_tasks(config.schedule_reconnect)
register_startup_tasks()
return app return app

View File

@ -342,7 +342,7 @@ def edit_book_read_status(book_id, read_status=None):
return "" return ""
# Deletes a book fro the local filestorage, returns True if deleting is successfull, otherwise false # Deletes a book from the local filestorage, returns True if deleting is successful, otherwise false
def delete_book_file(book, calibrepath, book_format=None): def delete_book_file(book, calibrepath, book_format=None):
# check that path is 2 elements deep, check that target path has no sub folders # check that path is 2 elements deep, check that target path has no sub folders
if book.path.count('/') == 1: if book.path.count('/') == 1:
@ -679,7 +679,8 @@ def update_dir_structure(book_id,
def delete_book(book, calibrepath, book_format): def delete_book(book, calibrepath, book_format):
clear_cover_thumbnail_cache(book.id) if not book_format:
clear_cover_thumbnail_cache(book.id) ## here it breaks
if config.config_use_google_drive: if config.config_use_google_drive:
return delete_book_gdrive(book, book_format) return delete_book_gdrive(book, book_format)
else: else:
@ -1003,21 +1004,26 @@ def get_download_link(book_id, book_format, client):
def clear_cover_thumbnail_cache(book_id): def clear_cover_thumbnail_cache(book_id):
if config.schedule_generate_book_covers:
WorkerThread.add(None, TaskClearCoverThumbnailCache(book_id), hidden=True) WorkerThread.add(None, TaskClearCoverThumbnailCache(book_id), hidden=True)
def replace_cover_thumbnail_cache(book_id): def replace_cover_thumbnail_cache(book_id):
if config.schedule_generate_book_covers:
WorkerThread.add(None, TaskClearCoverThumbnailCache(book_id), hidden=True) WorkerThread.add(None, TaskClearCoverThumbnailCache(book_id), hidden=True)
WorkerThread.add(None, TaskGenerateCoverThumbnails(book_id), hidden=True) WorkerThread.add(None, TaskGenerateCoverThumbnails(book_id), hidden=True)
def delete_thumbnail_cache(): def delete_thumbnail_cache():
if config.schedule_generate_book_covers:
WorkerThread.add(None, TaskClearCoverThumbnailCache(-1)) WorkerThread.add(None, TaskClearCoverThumbnailCache(-1))
def add_book_to_thumbnail_cache(book_id): def add_book_to_thumbnail_cache(book_id):
if config.schedule_generate_book_covers:
WorkerThread.add(None, TaskGenerateCoverThumbnails(book_id), hidden=True) WorkerThread.add(None, TaskGenerateCoverThumbnails(book_id), hidden=True)
def update_thumbnail_cache(): def update_thumbnail_cache():
if config.schedule_generate_book_covers:
WorkerThread.add(None, TaskGenerateCoverThumbnails()) WorkerThread.add(None, TaskGenerateCoverThumbnails())

View File

@ -22,13 +22,6 @@ from . import create_app
from .jinjia import jinjia from .jinjia import jinjia
from .remotelogin import remotelogin from .remotelogin import remotelogin
try:
from kobo import kobo, get_kobo_activated
from kobo_auth import kobo_auth
kobo_available = get_kobo_activated()
except (ImportError, AttributeError): # Catch also error for not installed flask-WTF (missing csrf decorator)
kobo_available = False
try: try:
from oauth_bb import oauth from oauth_bb import oauth
oauth_available = True oauth_available = True
@ -50,6 +43,12 @@ def main():
from .shelf import shelf from .shelf import shelf
from .tasks_status import tasks from .tasks_status import tasks
from .error_handler import init_errorhandler from .error_handler import init_errorhandler
try:
from .kobo import kobo, get_kobo_activated
from .kobo_auth import kobo_auth
kobo_available = get_kobo_activated()
except (ImportError, AttributeError): # Catch also error for not installed flask-WTF (missing csrf decorator)
kobo_available = False
from . import web_server from . import web_server
init_errorhandler() init_errorhandler()

File diff suppressed because it is too large Load Diff