Removed useless comments and imports

This commit is contained in:
Profitroll 2023-02-16 15:50:02 +01:00
parent 3520912aae
commit fe2ef49c74
3 changed files with 4 additions and 29 deletions

View File

@ -36,8 +36,6 @@ async def compress_image(image_path: str):
size_before = path.getsize(image_path) / 1024
# system(f"exiftool -overwrite_original -all:all= -tagsFromFile @ -exif:Orientation {image_path}")
if image_type == "image/jpeg":
task = Thread(target=system, kwargs={"command": f'jpegoptim "{image_path}" -o --max=55 -p --strip-none'})
elif image_type == "image/png":
@ -73,10 +71,6 @@ async def photo_upload(file: UploadFile, album: str, ignore_duplicates: bool = F
if col_albums.find_one( {"user": current_user.user, "name": album} ) is None:
raise AlbumNameNotFoundError(album)
# raise HTTPException(status_code=HTTP_404_NOT_FOUND, detail=f"Provided album '{album}' does not exist.")
# if not file.content_type.startswith("image"):
# raise HTTPException(status_code=HTTP_406_NOT_ACCEPTABLE, detail="Provided file is not an image, not accepting.")
makedirs(path.join("data", "users", current_user.user, "albums", album), exist_ok=True)

View File

@ -1,6 +1,5 @@
from datetime import datetime, timedelta
from classes.exceptions import UserAlreadyExists, UserCredentialsInvalid, UserEmailCodeInvalid
from classes.models import EmailConfirmed
from modules.database import col_users, col_albums, col_photos, col_emails, col_videos, col_emails
from modules.app import app
from modules.utils import configGet, logWrite

View File

@ -8,7 +8,6 @@ from datetime import datetime, timezone
from os import makedirs, path, remove
from classes.exceptions import AlbumNameNotFoundError, SearchPageInvalidError, SearchTokenInvalidError, VideoNotFoundError, VideoSearchQueryEmptyError
from classes.models import Video, SearchResultsVideo, VideoPublic
#from modules.unified_exif_reader import extract_location
from modules.security import User, get_current_active_user
from modules.app import app
from modules.database import col_videos, col_albums, col_tokens
@ -29,9 +28,6 @@ async def video_upload(file: UploadFile, album: str, caption: Union[str, None] =
if col_albums.find_one( {"user": current_user.user, "name": album} ) is None:
raise AlbumNameNotFoundError(album)
# if not file.content_type.startswith("video"):
# raise HTTPException(status_code=HTTP_406_NOT_ACCEPTABLE, detail="Provided file is not a video, not accepting.")
makedirs(path.join("data", "users", current_user.user, "albums", album), exist_ok=True)
filename = file.filename
@ -44,19 +40,10 @@ async def video_upload(file: UploadFile, album: str, caption: Union[str, None] =
with open(path.join("data", "users", current_user.user, "albums", album, filename), "wb") as f:
f.write(await file.read())
# file_hash = await get_phash(path.join("data", "users", current_user.user, "albums", album, filename))
# duplicates = await get_duplicates(file_hash, album)
# Hashing and duplicates check should be here
# if len(duplicates) > 0 and ignore_duplicates is False:
# return UJSONResponse(
# {
# "detail": "video duplicates found. Pass 'ignore_duplicates=true' to ignore.",
# "duplicates": duplicates
# },
# status_code=HTTP_409_CONFLICT
# )
# Coords extraction should be here
#coords = extract_location(path.join("data", "users", current_user.user, "albums", album, filename))
uploaded = col_videos.insert_one(
{
"user": current_user.user,
@ -66,12 +53,7 @@ async def video_upload(file: UploadFile, album: str, caption: Union[str, None] =
"uploaded": datetime.now(tz=timezone.utc),
"modified": datetime.now(tz=timezone.utc)
},
"caption": caption,
# "location": [
# coords["lng"],
# coords["lat"],
# coords["alt"]
# ]
"caption": caption
}
)