From 9b9db755e6771ac798ab4729f695547a3f374def Mon Sep 17 00:00:00 2001 From: ajurna Date: Tue, 13 Oct 2026 09:46:26 +0100 Subject: [PATCH] Handle unreadable archives and adjust cron job configuration - Skip page count assignment for corrupt or incompatible archives in comic processing. - Update `Dockerfile` to append crontab entries to `/etc/crontab` instead of `/etc/cron.daily/cbreader`. - Modify crontab entry to use the virtual environment's Python binary and include the `root` user for execution. --- Dockerfile | 2 +- cbreader/crontab | 2 +- comic/processing.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index b44da74..570259a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,6 +31,6 @@ RUN cd frontend \ && rm -r node_modules -RUN cat /src/cbreader/crontab >> /etc/cron.daily/cbreader +RUN cat /src/cbreader/crontab >> /etc/crontab EXPOSE 8000 diff --git a/cbreader/crontab b/cbreader/crontab index f5e86b6..7ef4832 100644 --- a/cbreader/crontab +++ b/cbreader/crontab @@ -1 +1 @@ -*/15 * * * * python /src/manage.py scan_comics --settings=cbreader.settings.base \ No newline at end of file +*/15 * * * * root /src/.venv/bin/python /src/manage.py scan_comics --settings=cbreader.settings.base diff --git a/comic/processing.py b/comic/processing.py index dd9d750..73acaa7 100644 --- a/comic/processing.py +++ b/comic/processing.py @@ -85,13 +85,14 @@ def clean_files(files: QuerySet, user: AbstractBaseUser, dir_path: Path, directo for new_comic in file_list - files_db_set: if new_comic.suffix.lower() in settings.SUPPORTED_FILES: new_book = models.ComicBook(file_name=new_comic.name, directory=directory) - archive, archive_type = new_book.get_archive() try: + archive, archive_type = new_book.get_archive() if archive_type == 'archive': new_book.page_count = len(get_archive_files(archive)) elif archive_type == 'pdf': new_book.page_count = archive.page_count except NotCompatibleArchive: + # Unreadable/corrupt archive - index the file with no page count pass books_to_add.append(new_book) models.ComicBook.objects.bulk_create(books_to_add)