Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Doc

Manav Rathife399762f5c5
diff --git a/web/apps/photos/src/services/upload/uploadService.ts b/web/apps/photos/src/services/upload/uploadService.ts
index 9150222f07..787629aca3 100644
--- a/web/apps/photos/src/services/upload/uploadService.ts
+++ b/web/apps/photos/src/services/upload/uploadService.ts
@@ -3,7 +3,7 @@ import { basename } from "@/base/file";
import log from "@/base/log";
import { CustomErrorMessage } from "@/base/types/ipc";
import { hasFileHash } from "@/media/file";
-import type { Metadata, ParsedMetadata } from "@/media/file-metadata";
+import type { Metadata, ParsedMetadata, PublicMagicMetadata } from "@/media/file-metadata";
import { FileType, type FileTypeInfo } from "@/media/file-type";
import { encodeLivePhoto } from "@/media/live-photo";
import { extractExif } from "@/new/photos/services/exif";
@@ -766,16 +766,16 @@ const extractImageOrVideoMetadata = async (
modificationTime;
const metadata: Metadata = {
+ fileType,
title: fileName,
creationTime,
modificationTime,
latitude: parsedMetadata.location.latitude,
longitude: parsedMetadata.location.longitude,
- fileType,
hash,
};
- const publicMagicMetadata: FilePublicMagicMetadataProps = {
+ const publicMagicMetadata: PublicMagicMetadata = {
w: parsedMetadata.width,
h: parsedMetadata.height,
};
diff --git a/web/packages/media/file-metadata.ts b/web/packages/media/file-metadata.ts
index c7a3b53444..58149f070d 100644
--- a/web/packages/media/file-metadata.ts
+++ b/web/packages/media/file-metadata.ts
@@ -72,12 +72,17 @@ export interface Metadata {
/**
* The time when this file was created (epoch microseconds).
*
- * For photos (and images in general), this is our best attempt (using Exif
- * and other metadata, or deducing it from file name for screenshots without
- * any embedded metadata) at detecting the time when the photo was taken.
+ * This is our best attempt at detecting the time when the photo or live
+ * photo or video was taken.
*
- * If nothing can be found, then it is set to the current time at the time
- * of the upload.
+ * - We first try to obtain this from metadata, using Exif and other
+ * metadata for images and FFmpeg-extracted metadata for video.
+ *
+ * - If no suitable metadata is available, then we try to deduce it from
+ * file name (e.g. for screenshots without any embedded metadata).
+ *
+ * - If nothing can be found, then it is set to the current time at the
+ * time of the upload.
*/
creationTime: number;
/**
@@ -85,20 +90,29 @@ export interface Metadata {
*/
modificationTime: number;
/**
- * The latitude where the image or video was taken.
+ * The latitude where the file was taken.
*/
latitude: number;
/**
- * The longitude where the image or video was taken.
+ * The longitude where the file was taken.
*/
longitude: number;
/**
* A hash of the file's contents.
+ *
+ * It is only valid for images and videos. For live photos, see
+ * {@link imageHash} and {@link videoHash}.
*/
hash?: string;
- hasStaticThumbnail?: boolean;
+ /**
+ * The hash of the image component of a live photo.
+ */
imageHash?: string;
+ /**
+ * The hash of the video component of a live photo.
+ */
videoHash?: string;
+ hasStaticThumbnail?: boolean;
localID?: number;
version?: number;
deviceFolder?: string;