ign
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
/* eslint-disable @typescript-eslint/dot-notation */
|
||||
import {
|
||||
parseDateFromDigitGroups,
|
||||
tryParseEpochMicrosecondsFromFileName,
|
||||
} from "ente-gallery/services/upload/date";
|
||||
import {
|
||||
matchTakeoutMetadata,
|
||||
metadataJSONMapKeyForJSON,
|
||||
} from "ente-gallery/services/upload/takeout";
|
||||
import { FileType } from "ente-media/file-type";
|
||||
import { getLocalCollections } from "ente-new/photos/services/collections";
|
||||
import {
|
||||
getLocalFiles,
|
||||
groupFilesByCollectionID,
|
||||
} from "ente-new/photos/services/files";
|
||||
import {
|
||||
parseDateFromDigitGroups,
|
||||
tryParseEpochMicrosecondsFromFileName,
|
||||
} from "services/upload/date";
|
||||
import {
|
||||
matchTakeoutMetadata,
|
||||
metadataJSONMapKeyForJSON,
|
||||
} from "services/upload/takeout";
|
||||
import { getUserDetailsV2 } from "services/userService";
|
||||
|
||||
const DATE_TIME_PARSING_TEST_FILE_NAMES = [
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// TODO: Audit this file
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
import { nameAndExtension } from "ente-base/file-name";
|
||||
import log from "ente-base/log";
|
||||
|
||||
@@ -35,10 +38,12 @@ const parseEpochMicrosecondsFromFileName = (fileName: string) => {
|
||||
if (fileName.startsWith("IMG-") || fileName.startsWith("VID-")) {
|
||||
// WhatsApp media files
|
||||
// - e.g. "IMG-20171218-WA0028.jpg"
|
||||
// @ts-ignore
|
||||
date = parseDateFromFusedDateString(fileName.split("-")[1]);
|
||||
} else if (fileName.startsWith("Screenshot_")) {
|
||||
// Screenshots on Android
|
||||
// - e.g. "Screenshot_20181227-152914.jpg"
|
||||
// @ts-ignore
|
||||
date = parseDateFromFusedDateString(
|
||||
fileName.replaceAll("Screenshot_", ""),
|
||||
);
|
||||
@@ -58,13 +63,16 @@ const parseEpochMicrosecondsFromFileName = (fileName: string) => {
|
||||
const p = fileName.split("-");
|
||||
if (p.length > 5) {
|
||||
const dateString = `${p[1]}${p[2]}${p[3]}-${p[4]}${p[5]}${p[6]}`;
|
||||
// @ts-ignore
|
||||
date = parseDateFromFusedDateString(dateString);
|
||||
} else {
|
||||
const dateString = `${p[1]}${p[2]}${p[3]}-${p[4]}`;
|
||||
// @ts-ignore
|
||||
date = parseDateFromFusedDateString(dateString);
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
if (!date) {
|
||||
const [name] = nameAndExtension(fileName);
|
||||
|
||||
@@ -89,13 +97,16 @@ const parseEpochMicrosecondsFromFileName = (fileName: string) => {
|
||||
const p = name.split("_");
|
||||
if (p.length == 3) {
|
||||
const dateString = `${p[0]}-${p[1]}`;
|
||||
// @ts-ignore
|
||||
date = parseDateFromFusedDateString(dateString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Generic pattern.
|
||||
// @ts-ignore
|
||||
if (!date) {
|
||||
// @ts-ignore
|
||||
date = parseDateFromDigitGroups(fileName);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
// TODO: Audit this file
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import {
|
||||
authenticatedPublicAlbumsRequestHeaders,
|
||||
authenticatedRequestHeaders,
|
||||
@@ -7,12 +11,12 @@ import {
|
||||
} from "ente-base/http";
|
||||
import log from "ente-base/log";
|
||||
import { apiURL, uploaderOrigin } from "ente-base/origins";
|
||||
import { EnteFile } from "ente-media/file";
|
||||
import { type EnteFile } from "ente-media/file";
|
||||
import { CustomError, handleUploadError } from "ente-shared/error";
|
||||
import HTTPService from "ente-shared/network/HTTPService";
|
||||
import { getToken } from "ente-shared/storage/localStorage/helpers";
|
||||
import { z } from "zod";
|
||||
import { MultipartUploadURLs, UploadFile } from "./upload-service";
|
||||
import type { MultipartUploadURLs, UploadFile } from "./upload-service";
|
||||
|
||||
/**
|
||||
* A pre-signed URL alongwith the associated object key.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
// TODO: Audit this file
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/dot-notation */
|
||||
/** @file Dealing with the JSON metadata sidecar files */
|
||||
|
||||
@@ -161,18 +165,24 @@ const parseMetadataJSONText = (text: string) => {
|
||||
const parsedMetadataJSON: ParsedMetadataJSON = {};
|
||||
|
||||
parsedMetadataJSON.creationTime =
|
||||
// @ts-ignore
|
||||
parseGTTimestamp(metadataJSON["photoTakenTime"]) ??
|
||||
// @ts-ignore
|
||||
parseGTTimestamp(metadataJSON["creationTime"]);
|
||||
|
||||
parsedMetadataJSON.modificationTime = parseGTTimestamp(
|
||||
// @ts-ignore
|
||||
metadataJSON["modificationTime"],
|
||||
);
|
||||
|
||||
parsedMetadataJSON.location =
|
||||
// @ts-ignore
|
||||
parseGTLocation(metadataJSON["geoData"]) ??
|
||||
// @ts-ignore
|
||||
parseGTLocation(metadataJSON["geoDataExif"]);
|
||||
|
||||
parsedMetadataJSON.description = parseGTNonEmptyString(
|
||||
// @ts-ignore
|
||||
metadataJSON["description"],
|
||||
);
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// TODO: Audit this file
|
||||
/* eslint-disable @typescript-eslint/prefer-promise-reject-errors */
|
||||
import log from "ente-base/log";
|
||||
import { type Electron } from "ente-base/types/ipc";
|
||||
import * as ffmpeg from "ente-gallery/services/ffmpeg";
|
||||
|
||||
Reference in New Issue
Block a user