move and merge
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { Dialog, DialogContent, Link } from "@mui/material";
|
||||
import { t } from "i18next";
|
||||
|
||||
import { UPLOAD_RESULT, UPLOAD_STAGES } from "@/new/photos/constants/upload";
|
||||
import {
|
||||
UPLOAD_RESULT,
|
||||
UPLOAD_STAGES,
|
||||
} from "@/new/photos/services/upload/types";
|
||||
import { dialogCloseHandler } from "@ente/shared/components/DialogBox/TitleWithCloseButton";
|
||||
import UploadProgressContext from "contexts/uploadProgress";
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { UPLOAD_RESULT, UPLOAD_STAGES } from "@/new/photos/constants/upload";
|
||||
import {
|
||||
UPLOAD_RESULT,
|
||||
UPLOAD_STAGES,
|
||||
} from "@/new/photos/services/upload/types";
|
||||
import { Button, DialogActions } from "@mui/material";
|
||||
import { t } from "i18next";
|
||||
import { useContext } from "react";
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
} from "./section";
|
||||
import { InProgressItemContainer } from "./styledComponents";
|
||||
|
||||
import { UPLOAD_STAGES } from "@/new/photos/constants/upload";
|
||||
import { UPLOAD_STAGES } from "@/new/photos/services/upload/types";
|
||||
import { CaptionedText } from "components/CaptionedText";
|
||||
|
||||
export const InProgressSection = () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UPLOAD_STAGES } from "@/new/photos/constants/upload";
|
||||
import { UPLOAD_STAGES } from "@/new/photos/services/upload/types";
|
||||
import UploadProgressContext from "contexts/uploadProgress";
|
||||
import { t } from "i18next";
|
||||
import { AppContext } from "pages/_app";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UPLOAD_STAGES } from "@/new/photos/constants/upload";
|
||||
import { UPLOAD_STAGES } from "@/new/photos/services/upload/types";
|
||||
import { Box, Divider, LinearProgress } from "@mui/material";
|
||||
import UploadProgressContext from "contexts/uploadProgress";
|
||||
import { useContext } from "react";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UPLOAD_RESULT } from "@/new/photos/constants/upload";
|
||||
import { UPLOAD_RESULT } from "@/new/photos/services/upload/types";
|
||||
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
||||
import { CaptionedText } from "components/CaptionedText";
|
||||
import ItemList from "components/ItemList";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UPLOAD_STAGES } from "@/new/photos/constants/upload";
|
||||
import { UPLOAD_STAGES } from "@/new/photos/services/upload/types";
|
||||
import {
|
||||
IconButtonWithBG,
|
||||
SpaceBetweenFlex,
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { UPLOAD_STAGES } from "@/new/photos/constants/upload";
|
||||
import { exportMetadataDirectoryName } from "@/new/photos/services/export";
|
||||
import type {
|
||||
FileAndPath,
|
||||
UploadItem,
|
||||
} from "@/new/photos/services/upload/types";
|
||||
import { UPLOAD_STAGES } from "@/new/photos/services/upload/types";
|
||||
import { basename } from "@/next/file";
|
||||
import log from "@/next/log";
|
||||
import type { CollectionMapping, Electron, ZipItem } from "@/next/types/ipc";
|
||||
@@ -21,7 +25,6 @@ import {
|
||||
getPublicCollectionUploaderName,
|
||||
savePublicCollectionUploaderName,
|
||||
} from "services/publicCollectionService";
|
||||
import type { FileAndPath, UploadItem } from "services/upload/types";
|
||||
import type {
|
||||
InProgressUpload,
|
||||
SegregatedFinishedUploads,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UPLOAD_STAGES } from "@/new/photos/constants/upload";
|
||||
import { UPLOAD_STAGES } from "@/new/photos/services/upload/types";
|
||||
import { createContext } from "react";
|
||||
import type {
|
||||
InProgressUpload,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { type FileTypeInfo } from "@/media/file-type";
|
||||
import { NULL_LOCATION } from "@/new/photos/constants/upload";
|
||||
import { NULL_LOCATION } from "@/new/photos/services/upload/types";
|
||||
import type {
|
||||
Location,
|
||||
ParsedExtractedMetadata,
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { NULL_LOCATION } from "@/new/photos/constants/upload";
|
||||
import {
|
||||
NULL_LOCATION,
|
||||
toDataOrPathOrZipEntry,
|
||||
type DesktopUploadItem,
|
||||
type UploadItem,
|
||||
} from "@/new/photos/services/upload/types";
|
||||
import type { ParsedExtractedMetadata } from "@/new/photos/types/metadata";
|
||||
import {
|
||||
readConvertToMP4Done,
|
||||
@@ -15,11 +20,6 @@ import {
|
||||
outputPathPlaceholder,
|
||||
} from "constants/ffmpeg";
|
||||
import type { DedicatedFFmpegWorker } from "worker/ffmpeg.worker";
|
||||
import {
|
||||
toDataOrPathOrZipEntry,
|
||||
type DesktopUploadItem,
|
||||
type UploadItem,
|
||||
} from "./upload/types";
|
||||
|
||||
/**
|
||||
* Generate a thumbnail for the given video using a wasm FFmpeg running in a web
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/** @file Dealing with the JSON metadata in Google Takeouts */
|
||||
|
||||
import { NULL_LOCATION } from "@/new/photos/constants/upload";
|
||||
import type { UploadItem } from "@/new/photos/services/upload/types";
|
||||
import { NULL_LOCATION } from "@/new/photos/services/upload/types";
|
||||
import type { Location } from "@/new/photos/types/metadata";
|
||||
import { readStream } from "@/new/photos/utils/native-stream";
|
||||
import { ensureElectron } from "@/next/electron";
|
||||
import { nameAndExtension } from "@/next/file";
|
||||
import log from "@/next/log";
|
||||
import type { UploadItem } from "./types";
|
||||
|
||||
export interface ParsedMetadataJSON {
|
||||
creationTime: number;
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import { FILE_TYPE, type FileTypeInfo } from "@/media/file-type";
|
||||
import { heicToJPEG } from "@/media/heic-convert";
|
||||
import { scaledImageDimensions } from "@/media/image";
|
||||
import {
|
||||
toDataOrPathOrZipEntry,
|
||||
type DesktopUploadItem,
|
||||
} from "@/new/photos/services/upload/types";
|
||||
import log from "@/next/log";
|
||||
import { type Electron } from "@/next/types/ipc";
|
||||
import { ensure } from "@/utils/ensure";
|
||||
import { withTimeout } from "@/utils/promise";
|
||||
import * as ffmpeg from "services/ffmpeg";
|
||||
import { toDataOrPathOrZipEntry, type DesktopUploadItem } from "./types";
|
||||
|
||||
/** Maximum width or height of the generated thumbnail */
|
||||
const maxThumbnailDimension = 720;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { FILE_TYPE } from "@/media/file-type";
|
||||
import { potentialFileTypeFromExtension } from "@/media/live-photo";
|
||||
import { getLocalFiles } from "@/new/photos/services/files";
|
||||
import type { UploadItem } from "@/new/photos/services/upload/types";
|
||||
import {
|
||||
RANDOM_PERCENTAGE_PROGRESS_FOR_PUT,
|
||||
UPLOAD_RESULT,
|
||||
UPLOAD_STAGES,
|
||||
} from "@/new/photos/constants/upload";
|
||||
import { getLocalFiles } from "@/new/photos/services/files";
|
||||
} from "@/new/photos/services/upload/types";
|
||||
import { EncryptedEnteFile, EnteFile } from "@/new/photos/types/file";
|
||||
import { ensureElectron } from "@/next/electron";
|
||||
import { lowercaseExtension, nameAndExtension } from "@/next/file";
|
||||
@@ -35,7 +36,6 @@ import {
|
||||
tryParseTakeoutMetadataJSON,
|
||||
type ParsedMetadataJSON,
|
||||
} from "./takeout";
|
||||
import type { UploadItem } from "./types";
|
||||
import UploadService, { uploadItemFileName, uploader } from "./uploadService";
|
||||
|
||||
export type FileID = number;
|
||||
|
||||
@@ -2,11 +2,12 @@ import { hasFileHash } from "@/media/file";
|
||||
import { FILE_TYPE, type FileTypeInfo } from "@/media/file-type";
|
||||
import { encodeLivePhoto } from "@/media/live-photo";
|
||||
import type { Metadata } from "@/media/types/file";
|
||||
import type { UploadItem } from "@/new/photos/services/upload/types";
|
||||
import {
|
||||
NULL_LOCATION,
|
||||
RANDOM_PERCENTAGE_PROGRESS_FOR_PUT,
|
||||
UPLOAD_RESULT,
|
||||
} from "@/new/photos/constants/upload";
|
||||
} from "@/new/photos/services/upload/types";
|
||||
import {
|
||||
EnteFile,
|
||||
MetadataFileAttributes,
|
||||
@@ -50,7 +51,6 @@ import {
|
||||
generateThumbnailNative,
|
||||
generateThumbnailWeb,
|
||||
} from "./thumbnail";
|
||||
import type { UploadItem } from "./types";
|
||||
import UploadHttpClient from "./uploadHttpClient";
|
||||
import type { UploadableUploadItem } from "./uploadManager";
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* watch folders functionality.
|
||||
*/
|
||||
|
||||
import { UPLOAD_RESULT } from "@/new/photos/constants/upload";
|
||||
import { getLocalFiles } from "@/new/photos/services/files";
|
||||
import { UPLOAD_RESULT } from "@/new/photos/services/upload/types";
|
||||
import { EncryptedEnteFile } from "@/new/photos/types/file";
|
||||
import { ensureElectron } from "@/next/electron";
|
||||
import { basename, dirname } from "@/next/file";
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import type { Location } from "../types/metadata";
|
||||
|
||||
export const RANDOM_PERCENTAGE_PROGRESS_FOR_PUT = () => 90 + 10 * Math.random();
|
||||
|
||||
export const NULL_LOCATION: Location = { latitude: null, longitude: null };
|
||||
|
||||
export enum UPLOAD_STAGES {
|
||||
START,
|
||||
READING_GOOGLE_METADATA_FILES,
|
||||
EXTRACTING_METADATA,
|
||||
UPLOADING,
|
||||
CANCELLING,
|
||||
FINISH,
|
||||
}
|
||||
|
||||
export enum UPLOAD_RESULT {
|
||||
FAILED,
|
||||
ALREADY_UPLOADED,
|
||||
UNSUPPORTED,
|
||||
BLOCKED,
|
||||
TOO_LARGE,
|
||||
LARGER_THAN_AVAILABLE_STORAGE,
|
||||
UPLOADED,
|
||||
UPLOADED_WITH_STATIC_THUMBNAIL,
|
||||
ADDED_SYMLINK,
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { ZipItem } from "@/next/types/ipc";
|
||||
import type { Location } from "../../types/metadata";
|
||||
|
||||
/**
|
||||
* An item to upload is one of the following:
|
||||
@@ -55,3 +56,28 @@ export const toDataOrPathOrZipEntry = (desktopUploadItem: DesktopUploadItem) =>
|
||||
typeof desktopUploadItem == "string" || Array.isArray(desktopUploadItem)
|
||||
? desktopUploadItem
|
||||
: desktopUploadItem.path;
|
||||
|
||||
export const RANDOM_PERCENTAGE_PROGRESS_FOR_PUT = () => 90 + 10 * Math.random();
|
||||
|
||||
export const NULL_LOCATION: Location = { latitude: null, longitude: null };
|
||||
|
||||
export enum UPLOAD_STAGES {
|
||||
START,
|
||||
READING_GOOGLE_METADATA_FILES,
|
||||
EXTRACTING_METADATA,
|
||||
UPLOADING,
|
||||
CANCELLING,
|
||||
FINISH,
|
||||
}
|
||||
|
||||
export enum UPLOAD_RESULT {
|
||||
FAILED,
|
||||
ALREADY_UPLOADED,
|
||||
UNSUPPORTED,
|
||||
BLOCKED,
|
||||
TOO_LARGE,
|
||||
LARGER_THAN_AVAILABLE_STORAGE,
|
||||
UPLOADED,
|
||||
UPLOADED_WITH_STATIC_THUMBNAIL,
|
||||
ADDED_SYMLINK,
|
||||
}
|
||||
Reference in New Issue
Block a user