pathlib support
This commit is contained in:
@@ -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"
|
||||
)
|
||||
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user