Added upload and modify dates
This commit is contained in:
parent
906674fcdb
commit
c693756a43
@ -76,7 +76,23 @@ async def photo_upload(file: UploadFile, album: str, ignore_duplicates: bool = F
|
||||
)
|
||||
|
||||
coords = extract_location(path.join("data", "users", current_user.user, "albums", album, filename))
|
||||
uploaded = col_photos.insert_one( {"user": current_user.user, "album": album, "hash": file_hash, "filename": filename, "location": [coords["lng"], coords["lat"], coords["alt"]]} )
|
||||
uploaded = col_photos.insert_one(
|
||||
{
|
||||
"user": current_user.user,
|
||||
"album": album,
|
||||
"hash": file_hash,
|
||||
"filename": filename,
|
||||
"dates": {
|
||||
"uploaded": datetime.utcnow(),
|
||||
"modifies": datetime.utcnow()
|
||||
},
|
||||
"location": [
|
||||
coords["lng"],
|
||||
coords["lat"],
|
||||
coords["alt"]
|
||||
]
|
||||
}
|
||||
)
|
||||
|
||||
if compress is True:
|
||||
scheduler.add_job(compress_image, trigger="date", run_date=datetime.now()+timedelta(seconds=1), args=[path.join("data", "users", current_user.user, "albums", album, filename)])
|
||||
@ -128,7 +144,7 @@ async def photo_move(id: str, album: str, current_user: User = Security(get_curr
|
||||
else:
|
||||
filename = image["filename"]
|
||||
|
||||
col_photos.find_one_and_update( {"_id": ObjectId(id)}, {"$set": {"album": album, "filename": filename}} )
|
||||
col_photos.find_one_and_update( {"_id": ObjectId(id)}, {"$set": {"album": album, "filename": filename, "dates.modified": datetime.utcnow()}} )
|
||||
|
||||
move(
|
||||
path.join("data", "users", current_user.user, "albums", image["album"], image["filename"]),
|
||||
|
@ -6,6 +6,7 @@ from magic import Magic
|
||||
from datetime import datetime
|
||||
from os import makedirs, path, remove
|
||||
from classes.models import Video, SearchResults
|
||||
#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
|
||||
@ -50,7 +51,23 @@ async def video_upload(file: UploadFile, album: str, current_user: User = Securi
|
||||
# status_code=HTTP_409_CONFLICT
|
||||
# )
|
||||
|
||||
uploaded = col_videos.insert_one( {"user": current_user.user, "album": album, "filename": filename} )
|
||||
#coords = extract_location(path.join("data", "users", current_user.user, "albums", album, filename))
|
||||
uploaded = col_videos.insert_one(
|
||||
{
|
||||
"user": current_user.user,
|
||||
"album": album,
|
||||
"filename": filename,
|
||||
"dates": {
|
||||
"uploaded": datetime.utcnow(),
|
||||
"modifies": datetime.utcnow()
|
||||
},
|
||||
# "location": [
|
||||
# coords["lng"],
|
||||
# coords["lat"],
|
||||
# coords["alt"]
|
||||
# ]
|
||||
}
|
||||
)
|
||||
|
||||
return UJSONResponse(
|
||||
{
|
||||
@ -98,7 +115,7 @@ async def video_move(id: str, album: str, current_user: User = Security(get_curr
|
||||
else:
|
||||
filename = video["filename"]
|
||||
|
||||
col_videos.find_one_and_update( {"_id": ObjectId(id)}, {"$set": {"album": album, "filename": filename}} )
|
||||
col_videos.find_one_and_update( {"_id": ObjectId(id)}, {"$set": {"album": album, "filename": filename, "dates.modified": datetime.utcnow()}} )
|
||||
|
||||
move(
|
||||
path.join("data", "users", current_user.user, "albums", video["album"], video["filename"]),
|
||||
|
Loading…
Reference in New Issue
Block a user