mirror of
https://github.com/ajurna/cbwebreader.git
synced 2026-11-02 10:36:55 +00:00
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.
This commit is contained in:
1 parent
1bbe0071a0
commit
9b9db755e6
3 files changed
+4
-3
No files matched your search
+2
-1
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user