소스 검색

To point of use

Manav Rathi 1 년 전
부모
커밋
19103f4961
2개의 변경된 파일31개의 추가작업 그리고 31개의 파일을 삭제
  1. 0 31
      web/apps/photos/src/services/upload/metadataService.ts
  2. 31 0
      web/apps/photos/src/services/upload/uploadService.ts

+ 0 - 31
web/apps/photos/src/services/upload/metadataService.ts

@@ -1,4 +1,3 @@
-import { encodeLivePhoto } from "@/media/live-photo";
 import { ensureElectron } from "@/next/electron";
 import { basename, getFileNameSize } from "@/next/file";
 import log from "@/next/log";
@@ -31,9 +30,7 @@ import {
     type LivePhotoAssets2,
 } from "types/upload";
 import { getFileTypeFromExtensionForLivePhotoClustering } from "utils/file/livePhoto";
-import { getUint8ArrayView } from "../readerService";
 import { getEXIFLocation, getEXIFTime, getParsedExifData } from "./exifService";
-import { generateThumbnail } from "./thumbnailService";
 import uploadCancelService from "./uploadCancelService";
 import { extractFileMetadata, getFileName } from "./uploadService";
 
@@ -393,34 +390,6 @@ export function getLivePhotoSize(livePhotoAssets: LivePhotoAssets) {
 export const getLivePhotoName = ({ image }: LivePhotoAssets2) =>
     typeof image == "string" ? basename(image) : image.name;
 
-export async function readLivePhoto(
-    fileTypeInfo: FileTypeInfo,
-    livePhotoAssets: LivePhotoAssets,
-) {
-    const { thumbnail, hasStaticThumbnail } = await generateThumbnail(
-        livePhotoAssets.image,
-        {
-            exactType: fileTypeInfo.imageType,
-            fileType: FILE_TYPE.IMAGE,
-        },
-    );
-
-    const imageData = await getUint8ArrayView(livePhotoAssets.image);
-
-    const videoData = await getUint8ArrayView(livePhotoAssets.video);
-
-    return {
-        filedata: await encodeLivePhoto({
-            imageFileName: livePhotoAssets.image.name,
-            imageData,
-            videoFileName: livePhotoAssets.video.name,
-            videoData,
-        }),
-        thumbnail,
-        hasStaticThumbnail,
-    };
-}
-
 export async function clusterLivePhotoFiles(mediaFiles: FileWithCollection2[]) {
     try {
         const analysedMediaFiles: FileWithCollection2[] = [];

+ 31 - 0
web/apps/photos/src/services/upload/uploadService.ts

@@ -1,3 +1,4 @@
+import { encodeLivePhoto } from "@/media/live-photo";
 import {
     basename,
     convertBytesToHumanReadable,
@@ -12,6 +13,7 @@ import {
 import { CustomError, handleUploadError } from "@ente/shared/error";
 import { wait } from "@ente/shared/utils";
 import { Remote } from "comlink";
+import { FILE_TYPE } from "constants/file";
 import {
     FILE_READER_CHUNK_SIZE,
     MULTIPART_PART_SIZE,
@@ -44,6 +46,7 @@ import {
     UploadURL,
     isDataStream,
     type FileWithCollection2,
+    type LivePhotoAssets,
     type UploadAsset2,
 } from "types/upload";
 import {
@@ -397,6 +400,34 @@ async function readFile(
     };
 }
 
+async function readLivePhoto(
+    fileTypeInfo: FileTypeInfo,
+    livePhotoAssets: LivePhotoAssets,
+) {
+    const { thumbnail, hasStaticThumbnail } = await generateThumbnail(
+        livePhotoAssets.image,
+        {
+            exactType: fileTypeInfo.imageType,
+            fileType: FILE_TYPE.IMAGE,
+        },
+    );
+
+    const imageData = await getUint8ArrayView(livePhotoAssets.image);
+
+    const videoData = await getUint8ArrayView(livePhotoAssets.video);
+
+    return {
+        filedata: await encodeLivePhoto({
+            imageFileName: livePhotoAssets.image.name,
+            imageData,
+            videoFileName: livePhotoAssets.video.name,
+            videoData,
+        }),
+        thumbnail,
+        hasStaticThumbnail,
+    };
+}
+
 export async function extractFileMetadata(
     worker: Remote<DedicatedCryptoWorker>,
     parsedMetadataJSONMap: ParsedMetadataJSONMap,