Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix exif iptc (#2138)

Stanimir28a4935813b7
diff --git a/package-lock.json b/package-lock.json
index f1ddda325..2a756b233 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -38,7 +38,7 @@
"electron-log": "^4.4.8",
"electron-updater": "^6.1.4",
"electron-window-state": "^5.0.3",
- "exif-js": "^2.3.0",
+ "exifr": "^7.1.3",
"file-saver": "^2.0.5",
"find-free-ports": "^3.1.1",
"fs-extra": "^10.0.0",
@@ -196,7 +196,7 @@
"yarn": "please-use-npm"
},
"optionalDependencies": {
- "@tagspacespro/tagspacespro": "5.0.58"
+ "@tagspacespro/tagspacespro": "5.0.59"
}
},
"node_modules/@adobe/css-tools": {
@@ -13873,9 +13873,9 @@
}
},
"node_modules/@tagspacespro/tagspacespro": {
- "version": "5.0.58",
- "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.58/de03c97573cbccf1e26a3d999823cab107211cc2",
- "integrity": "sha512-YscoWetio7TXh1USC1SxQb44Tmt9mcR/ep4PE6v3rOcvkc6srF0bqKy9q7trNTFxG16pqcdkebfAjfdqvMFs/A==",
+ "version": "5.0.59",
+ "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.59/df254c90d29cd119d855df905eb99f983307eaf5",
+ "integrity": "sha512-9bGT1pyJ/Rnu15FpJ97/3SO1OtOfvxPPJh3gKQBHTJlfQMR212sSQ1tSLe7lFrBh5rWM44WGM7o7yjR1BzlIqg==",
"license": "Proprietary",
"optional": true
},
@@ -23227,10 +23227,10 @@
"integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==",
"dev": true
},
- "node_modules/exif-js": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/exif-js/-/exif-js-2.3.0.tgz",
- "integrity": "sha512-1Og9pAzG2FZRVlaavH8bB8BTeHcjMdJhKmeQITkX+uLRCD0xPtKAdZ2clZmQdJ56p9adXtJ8+jwrGp/4505lYg=="
+ "node_modules/exifr": {
+ "version": "7.1.3",
+ "resolved": "https://registry.npmjs.org/exifr/-/exifr-7.1.3.tgz",
+ "integrity": "sha512-g/aje2noHivrRSLbAUtBPWFbxKdKhgj/xr1vATDdUXPOFYJlQ62Ft0oy+72V6XLIpDJfHs6gXLbBLAolqOXYRw=="
},
"node_modules/exit": {
"version": "0.1.2",
diff --git a/package.json b/package.json
index 0f7e7006b..95b49369f 100644
--- a/package.json
+++ b/package.json
@@ -179,7 +179,7 @@
"electron-log": "^4.4.8",
"electron-updater": "^6.1.4",
"electron-window-state": "^5.0.3",
- "exif-js": "^2.3.0",
+ "exifr": "^7.1.3",
"file-saver": "^2.0.5",
"find-free-ports": "^3.1.1",
"fs-extra": "^10.0.0",
@@ -229,7 +229,7 @@
"uuid": "^9.0.0"
},
"optionalDependencies": {
- "@tagspacespro/tagspacespro": "5.0.58"
+ "@tagspacespro/tagspacespro": "5.0.59"
},
"devDependencies": {
"@electron/notarize": "^2.3.2",
diff --git a/src/renderer/hooks/TaggingActionsContextProvider.tsx b/src/renderer/hooks/TaggingActionsContextProvider.tsx
index 2b5fcdb31..f34d5def0 100644
--- a/src/renderer/hooks/TaggingActionsContextProvider.tsx
+++ b/src/renderer/hooks/TaggingActionsContextProvider.tsx
@@ -17,8 +17,7 @@
*/
import React, { createContext, useMemo, useReducer, useRef } from 'react';
-import { useDispatch, useSelector } from 'react-redux';
-import { actions as AppActions, AppDispatch } from '-/reducers/app';
+import { useSelector } from 'react-redux';
import mgrs from 'mgrs';
import { Pro } from '-/pro';
import { useTranslation } from 'react-i18next';
@@ -60,15 +59,7 @@ import { useEditedTagLibraryContext } from '-/hooks/useEditedTagLibraryContext';
import { CommonLocation } from '-/utils/CommonLocation';
import LoadingLazy from '-/components/LoadingLazy';
-type extractOptions = {
- EXIFGeo?: boolean;
- EXIFDateTime?: boolean;
- IPTCDescription?: boolean;
- IPTCTags?: boolean;
-};
-
type TaggingActionsContextData = {
- extractContent: (options?: extractOptions) => Promise<boolean>;
addFilesTags: (files: { [filePath: string]: TS.Tag[] }) => Promise<boolean>;
addTags: (paths: Array<string>, tags: Array<TS.Tag>) => Promise<boolean>;
addTagsToEntry: (
@@ -119,7 +110,6 @@ type TaggingActionsContextData = {
};
export const TaggingActionsContext = createContext<TaggingActionsContextData>({
- extractContent: undefined,
addFilesTags: undefined,
addTags: undefined,
addTagsToEntry: undefined,
@@ -176,7 +166,7 @@ export const TaggingActionsContextProvider = ({
const { renameFile, saveMetaDataPromise, saveCurrentLocationMetaData } =
useIOActionsContext();
const { reflectUpdateMeta, setReflectActions } = useEditedEntryContext();
- const { showNotification, hideNotifications } = useNotificationContext();
+ const { showNotification } = useNotificationContext();
const open = useRef<boolean>(false);
const selectedTag = useRef<TS.Tag>(undefined);
@@ -192,29 +182,6 @@ export const TaggingActionsContextProvider = ({
const filenameTagPlacedAtEnd = useSelector(getFileNameTagPlace);
const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);
- function extractContent(
- options: extractOptions = {
- EXIFGeo: true,
- EXIFDateTime: true,
- IPTCDescription: true,
- IPTCTags: true,
- },
- ): Promise<boolean> {
- if (!Pro || !Pro.ContentExtractor) {
- showNotification(t('core:thisFunctionalityIsAvailableInPro'));
- return Promise.resolve(false);
- }
- showNotification('Extracting content...', 'info', false);
- return Pro.ContentExtractor.extractContent(
- currentDirectoryEntries,
- currentLocation.getFileContentPromise,
- options,
- ).then((extracted: { [filePath: string]: TS.Tag[] }) => {
- hideNotifications();
- return addFilesTags(extracted);
- });
- }
-
function addTagsToFilePath(path: string, tags: string[]) {
if (tags && tags.length > 0) {
const extractedTags: string[] = extractTags(
@@ -1492,7 +1459,6 @@ export const TaggingActionsContextProvider = ({
const context = useMemo(() => {
return {
- extractContent,
addFilesTags,
addTags,
addTagsToEntry,
diff --git a/src/renderer/tagspaces.namespace.d.ts b/src/renderer/tagspaces.namespace.d.ts
index 6a06af690..ad90399e0 100644
--- a/src/renderer/tagspaces.namespace.d.ts
+++ b/src/renderer/tagspaces.namespace.d.ts
@@ -248,6 +248,19 @@ export namespace TS {
delBookmark: (filePath: string) => void;
};
+ type extractOptions = {
+ EXIFGeo?: boolean;
+ EXIFDateTime?: boolean;
+ IPTCDescription?: boolean;
+ IPTCTags?: boolean;
+ };
+
+ type ExifExtractionContextData = {
+ extractContent: (
+ options: extractOptions,
+ ) => Promise<{ [filePath: string]: TS.Tag[] }>;
+ };
+
type HistoryContextData = {
fileOpenHistory: TS.HistoryItem[];
folderOpenHistory: TS.HistoryItem[];