Rename
This commit is contained in:
parent
1106393045
commit
5c07751c8c
6 changed files with 17 additions and 17 deletions
|
@ -43,7 +43,7 @@ import mime from "mime-types";
|
|||
import { AppContext } from "pages/_app";
|
||||
import { getLocalCollections } from "services/collectionService";
|
||||
import downloadManager from "services/download";
|
||||
import { getFileType } from "services/typeDetectionService";
|
||||
import { deduceFileTypeInfo } from "services/typeDetectionService";
|
||||
import uploadManager from "services/upload/uploadManager";
|
||||
import { EnteFile } from "types/file";
|
||||
import { FileWithCollection } from "types/upload";
|
||||
|
@ -486,7 +486,7 @@ const ImageEditorOverlay = (props: IProps) => {
|
|||
if (!canvasRef.current) return;
|
||||
|
||||
const editedFile = await getEditedFile();
|
||||
const fileType = await getFileType(editedFile);
|
||||
const fileType = await deduceFileTypeInfo(editedFile);
|
||||
const tempImgURL = URL.createObjectURL(
|
||||
new Blob([editedFile], { type: fileType.mimeType }),
|
||||
);
|
||||
|
|
|
@ -46,7 +46,7 @@ import { GalleryContext } from "pages/gallery";
|
|||
import downloadManager, { LoadedLivePhotoSourceURL } from "services/download";
|
||||
import { getParsedExifData } from "services/exif";
|
||||
import { trashFiles } from "services/fileService";
|
||||
import { getFileType } from "services/typeDetectionService";
|
||||
import { deduceFileTypeInfo } from "services/typeDetectionService";
|
||||
import { SetFilesDownloadProgressAttributesCreator } from "types/gallery";
|
||||
import { isClipboardItemPresent } from "utils/common";
|
||||
import { pauseVideo, playVideo } from "utils/photoFrame";
|
||||
|
@ -594,7 +594,7 @@ function PhotoViewer(props: Iprops) {
|
|||
.image;
|
||||
fileObject = await getFileFromURL(url, file.metadata.title);
|
||||
}
|
||||
const fileTypeInfo = await getFileType(fileObject);
|
||||
const fileTypeInfo = await deduceFileTypeInfo(fileObject);
|
||||
const exifData = await getParsedExifData(
|
||||
fileObject,
|
||||
fileTypeInfo,
|
||||
|
|
|
@ -2,7 +2,7 @@ import { FILE_TYPE } from "@/media/file-type";
|
|||
import log from "@/next/log";
|
||||
import { validateAndGetCreationUnixTimeInMicroSeconds } from "@ente/shared/time";
|
||||
import type { FixOption } from "components/FixCreationTime";
|
||||
import { getFileType } from "services/typeDetectionService";
|
||||
import { deduceFileTypeInfo } from "services/typeDetectionService";
|
||||
import { EnteFile } from "types/file";
|
||||
import {
|
||||
changeFileCreationTime,
|
||||
|
@ -53,7 +53,7 @@ export async function updateCreationTimeWithExif(
|
|||
[fileBlob],
|
||||
file.metadata.title,
|
||||
);
|
||||
const fileTypeInfo = await getFileType(fileObject);
|
||||
const fileTypeInfo = await deduceFileTypeInfo(fileObject);
|
||||
const exifData = await getParsedExifData(
|
||||
fileObject,
|
||||
fileTypeInfo,
|
||||
|
|
|
@ -15,7 +15,7 @@ const TYPE_VIDEO = "video";
|
|||
const TYPE_IMAGE = "image";
|
||||
const CHUNK_SIZE_FOR_TYPE_DETECTION = 4100;
|
||||
|
||||
export async function getFileType(
|
||||
export async function deduceFileTypeInfo(
|
||||
receivedFile: File | ElectronFile,
|
||||
): Promise<FileTypeInfo> {
|
||||
try {
|
||||
|
|
|
@ -48,7 +48,7 @@ import { readStream } from "utils/native-stream";
|
|||
import { hasFileHash } from "utils/upload";
|
||||
import * as convert from "xml-js";
|
||||
import { getFileStream } from "../readerService";
|
||||
import { getFileType } from "../typeDetectionService";
|
||||
import { deduceFileTypeInfo } from "../typeDetectionService";
|
||||
import { extractAssetMetadata } from "./metadata";
|
||||
import publicUploadHttpClient from "./publicUploadHttpClient";
|
||||
import type { ParsedMetadataJSON } from "./takeout";
|
||||
|
@ -331,14 +331,14 @@ const getAssetFileType = ({
|
|||
}: UploadAsset) => {
|
||||
return isLivePhoto
|
||||
? getLivePhotoFileType(livePhotoAssets)
|
||||
: getFileType(file);
|
||||
: deduceFileTypeInfo(file);
|
||||
};
|
||||
|
||||
const getLivePhotoFileType = async (
|
||||
livePhotoAssets: LivePhotoAssets,
|
||||
): Promise<FileTypeInfo> => {
|
||||
const imageFileTypeInfo = await getFileType(livePhotoAssets.image);
|
||||
const videoFileTypeInfo = await getFileType(livePhotoAssets.video);
|
||||
const imageFileTypeInfo = await deduceFileTypeInfo(livePhotoAssets.image);
|
||||
const videoFileTypeInfo = await deduceFileTypeInfo(livePhotoAssets.video);
|
||||
return {
|
||||
fileType: FILE_TYPE.LIVE_PHOTO,
|
||||
exactType: `${imageFileTypeInfo.exactType}+${videoFileTypeInfo.exactType}`,
|
||||
|
|
|
@ -19,7 +19,7 @@ import {
|
|||
updateFilePublicMagicMetadata,
|
||||
} from "services/fileService";
|
||||
import { heicToJPEG } from "services/heic-convert";
|
||||
import { getFileType } from "services/typeDetectionService";
|
||||
import { deduceFileTypeInfo } from "services/typeDetectionService";
|
||||
import {
|
||||
EncryptedEnteFile,
|
||||
EnteFile,
|
||||
|
@ -130,19 +130,19 @@ export async function downloadFile(file: EnteFile) {
|
|||
const { imageFileName, imageData, videoFileName, videoData } =
|
||||
await decodeLivePhoto(file.metadata.title, fileBlob);
|
||||
const image = new File([imageData], imageFileName);
|
||||
const imageType = await getFileType(image);
|
||||
const imageType = await deduceFileTypeInfo(image);
|
||||
const tempImageURL = URL.createObjectURL(
|
||||
new Blob([imageData], { type: imageType.mimeType }),
|
||||
);
|
||||
const video = new File([videoData], videoFileName);
|
||||
const videoType = await getFileType(video);
|
||||
const videoType = await deduceFileTypeInfo(video);
|
||||
const tempVideoURL = URL.createObjectURL(
|
||||
new Blob([videoData], { type: videoType.mimeType }),
|
||||
);
|
||||
downloadUsingAnchor(tempImageURL, imageFileName);
|
||||
downloadUsingAnchor(tempVideoURL, videoFileName);
|
||||
} else {
|
||||
const fileType = await getFileType(
|
||||
const fileType = await deduceFileTypeInfo(
|
||||
new File([fileBlob], file.metadata.title),
|
||||
);
|
||||
fileBlob = await new Response(
|
||||
|
@ -305,7 +305,7 @@ export const getRenderableImage = async (fileName: string, imageBlob: Blob) => {
|
|||
let fileTypeInfo: FileTypeInfo;
|
||||
try {
|
||||
const tempFile = new File([imageBlob], fileName);
|
||||
fileTypeInfo = await getFileType(tempFile);
|
||||
fileTypeInfo = await deduceFileTypeInfo(tempFile);
|
||||
log.debug(
|
||||
() =>
|
||||
`Obtaining renderable image for ${JSON.stringify(fileTypeInfo)}`,
|
||||
|
@ -724,7 +724,7 @@ export const getArchivedFiles = (files: EnteFile[]) => {
|
|||
};
|
||||
|
||||
export const createTypedObjectURL = async (blob: Blob, fileName: string) => {
|
||||
const type = await getFileType(new File([blob], fileName));
|
||||
const type = await deduceFileTypeInfo(new File([blob], fileName));
|
||||
return URL.createObjectURL(new Blob([blob], { type: type.mimeType }));
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue