Parallel
This commit is contained in:
parent
32ac31fd44
commit
5dd21b2b38
2 changed files with 18 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
import { encodeLivePhoto } from "@/media/live-photo";
|
||||
import { getFileNameSize } from "@/next/file";
|
||||
import { basename, getFileNameSize } from "@/next/file";
|
||||
import log from "@/next/log";
|
||||
import { DedicatedCryptoWorker } from "@ente/shared/crypto/internal/crypto.worker";
|
||||
import { CustomError } from "@ente/shared/error";
|
||||
|
@ -32,6 +32,7 @@ import {
|
|||
ParsedExtractedMetadata,
|
||||
ParsedMetadataJSON,
|
||||
ParsedMetadataJSONMap,
|
||||
type LivePhotoAssets2,
|
||||
} from "types/upload";
|
||||
import { getFileTypeFromExtensionForLivePhotoClustering } from "utils/file/livePhoto";
|
||||
import { getUint8ArrayView } from "../readerService";
|
||||
|
@ -374,9 +375,8 @@ export function getLivePhotoSize(livePhotoAssets: LivePhotoAssets) {
|
|||
return livePhotoAssets.image.size + livePhotoAssets.video.size;
|
||||
}
|
||||
|
||||
export function getLivePhotoName(livePhotoAssets: LivePhotoAssets) {
|
||||
return livePhotoAssets.image.name;
|
||||
}
|
||||
export const getLivePhotoName = ({ image }: LivePhotoAssets2) =>
|
||||
typeof image == "string" ? basename(image) : image.name;
|
||||
|
||||
export async function readLivePhoto(
|
||||
fileTypeInfo: FileTypeInfo,
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
import { convertBytesToHumanReadable, getFileNameSize } from "@/next/file";
|
||||
import {
|
||||
basename,
|
||||
convertBytesToHumanReadable,
|
||||
getFileNameSize,
|
||||
} from "@/next/file";
|
||||
import log from "@/next/log";
|
||||
import { DedicatedCryptoWorker } from "@ente/shared/crypto/internal/crypto.worker";
|
||||
import {
|
||||
|
@ -41,6 +45,7 @@ import {
|
|||
UploadFile,
|
||||
UploadURL,
|
||||
isDataStream,
|
||||
type UploadAsset2,
|
||||
} from "types/upload";
|
||||
import {
|
||||
getNonEmptyMagicMetadataProps,
|
||||
|
@ -133,6 +138,12 @@ class UploadService {
|
|||
: getFilename(file);
|
||||
}
|
||||
|
||||
getAssetName2({ isLivePhoto, file, livePhotoAssets }: UploadAsset2) {
|
||||
return isLivePhoto
|
||||
? getLivePhotoName(livePhotoAssets)
|
||||
: getFilename(file);
|
||||
}
|
||||
|
||||
getAssetFileType({ isLivePhoto, file, livePhotoAssets }: UploadAsset) {
|
||||
return isLivePhoto
|
||||
? getLivePhotoFileType(livePhotoAssets)
|
||||
|
@ -361,9 +372,8 @@ function getFileSize(file: File | ElectronFile) {
|
|||
return file.size;
|
||||
}
|
||||
|
||||
function getFilename(file: File | ElectronFile) {
|
||||
return file.name;
|
||||
}
|
||||
const getFilename = (file: File | ElectronFile | string) =>
|
||||
typeof file == "string" ? basename(file) : file.name;
|
||||
|
||||
async function readFile(
|
||||
fileTypeInfo: FileTypeInfo,
|
||||
|
|
Loading…
Add table
Reference in a new issue