pathlib support

This commit is contained in:
2023-06-23 11:17:02 +02:00
parent 88d8a38444
commit 23467a88ef
4 changed files with 11 additions and 11 deletions

View File

@@ -66,12 +66,12 @@ async def compress_image(image_path: str):
return
task.start()
logWrite(f"Compressing '{path.split(image_path)[-1]}'...")
logWrite(f"Compressing '{Path(image_path).name}'...")
task.join()
size_after = path.getsize(image_path) / 1024
logWrite(
f"Compressed '{path.split(image_path)[-1]}' from {size_before} Kb to {size_after} Kb"
f"Compressed '{Path(image_path).name}' from {size_before} Kb to {size_after} Kb"
)

View File

@@ -1,12 +1,11 @@
import re
from datetime import datetime, timezone
from os import makedirs, path, remove
from os import makedirs, remove
from pathlib import Path
from secrets import token_urlsafe
from shutil import move
from typing import Union
from pathlib import Path
import aiofiles
from bson.errors import InvalidId
from bson.objectid import ObjectId