Changed to use pathlib.Path

This commit is contained in:
Lukas Metzger 2024-09-07 16:39:06 +00:00
parent a30c9f6efe
commit 15f151f5fe

View File

@ -1,5 +1,4 @@
import logging import logging
import os
import re import re
import tempfile import tempfile
from dataclasses import dataclass from dataclasses import dataclass
@ -263,8 +262,8 @@ class BarcodePlugin(ConsumeTaskPlugin):
)[0] )[0]
# Remember filename, since it is lost by upscaling # Remember filename, since it is lost by upscaling
page_filename = page.filename page_filepath = Path(page.filename)
logger.debug(f"Image is at {page_filename}") logger.debug(f"Image is at {page_filepath}")
# Upscale image if configured # Upscale image if configured
factor = settings.CONSUMER_BARCODE_UPSCALE factor = settings.CONSUMER_BARCODE_UPSCALE
@ -284,7 +283,7 @@ class BarcodePlugin(ConsumeTaskPlugin):
) )
# Delete temporary image file # Delete temporary image file
os.remove(page_filename) page_filepath.unlink()
# Password protected files can't be checked # Password protected files can't be checked
# This is the exception raised for those # This is the exception raised for those