diff --git a/extensions/photos.py b/extensions/photos.py index 8af8e7c..f30e8f1 100644 --- a/extensions/photos.py +++ b/extensions/photos.py @@ -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) diff --git a/extensions/users.py b/extensions/users.py index 02a14d7..0bdaf76 100644 --- a/extensions/users.py +++ b/extensions/users.py @@ -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 diff --git a/extensions/videos.py b/extensions/videos.py index daa2c4e..7a00abe 100644 --- a/extensions/videos.py +++ b/extensions/videos.py @@ -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) - - # 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 - # ) + # Hashing and duplicates check should be here - #coords = extract_location(path.join("data", "users", current_user.user, "albums", album, filename)) + # Coords extraction should be here + 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 } )