Unnull
This commit is contained in:
@@ -3,7 +3,11 @@ 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, PublicMagicMetadata } 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";
|
||||
@@ -765,20 +769,23 @@ const extractImageOrVideoMetadata = async (
|
||||
tryParseEpochMicrosecondsFromFileName(fileName) ??
|
||||
modificationTime;
|
||||
|
||||
const { width: w, height: h, location } = parsedMetadata;
|
||||
|
||||
const metadata: Metadata = {
|
||||
fileType,
|
||||
title: fileName,
|
||||
creationTime,
|
||||
modificationTime,
|
||||
latitude: parsedMetadata.location.latitude,
|
||||
longitude: parsedMetadata.location.longitude,
|
||||
hash,
|
||||
};
|
||||
if (location) {
|
||||
metadata.latitude = location.latitude;
|
||||
metadata.longitude = location.longitude;
|
||||
}
|
||||
|
||||
const publicMagicMetadata: PublicMagicMetadata = {
|
||||
w: parsedMetadata.width,
|
||||
h: parsedMetadata.height,
|
||||
};
|
||||
const publicMagicMetadata: PublicMagicMetadata = {};
|
||||
if (w) publicMagicMetadata.w = w;
|
||||
if (h) publicMagicMetadata.h = h;
|
||||
|
||||
const takeoutMetadata = matchTakeoutMetadata(
|
||||
fileName,
|
||||
|
||||
@@ -92,11 +92,11 @@ export interface Metadata {
|
||||
/**
|
||||
* The latitude where the file was taken.
|
||||
*/
|
||||
latitude: number;
|
||||
latitude?: number;
|
||||
/**
|
||||
* The longitude where the file was taken.
|
||||
*/
|
||||
longitude: number;
|
||||
longitude?: number;
|
||||
/**
|
||||
* A hash of the file's contents.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user