mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-22 10:26:33 +02:00
feat(tag-editor): add batch metadata editor with artwork support (Duplicate) (#2252)
* feat(tag-editor): add batch metadata editor with artwork support --------- Co-authored-by: jeffvli <jeffvictorli@gmail.com>
This commit is contained in:
+45
-1
@@ -1,4 +1,13 @@
|
||||
import { ipcRenderer, webFrame } from 'electron';
|
||||
import { ipcRenderer, type IpcRendererEvent, webFrame } from 'electron';
|
||||
|
||||
import type {
|
||||
ArtworkOp,
|
||||
BatchProgress,
|
||||
ReadLocalImageResult,
|
||||
ReadSongMetadataBatchResult,
|
||||
TagValue,
|
||||
WriteSongTagsBatchResult,
|
||||
} from '../shared/types/tag-editor';
|
||||
|
||||
import { disableAutoUpdates, isLinux, isMacOS, isWindows } from '../main/env';
|
||||
|
||||
@@ -6,6 +15,35 @@ const openItem = async (path: string) => {
|
||||
return ipcRenderer.invoke('open-item', path);
|
||||
};
|
||||
|
||||
const cancelReadSongMetadata = (): void => {
|
||||
ipcRenderer.invoke('cancel-read-song-metadata');
|
||||
};
|
||||
|
||||
const readSongMetadataBatch = (filePaths: string[]): Promise<ReadSongMetadataBatchResult> => {
|
||||
return ipcRenderer.invoke('read-song-metadata-batch', filePaths);
|
||||
};
|
||||
|
||||
const writeSongTagsBatch = (
|
||||
filePaths: string[],
|
||||
edits: Record<string, TagValue>,
|
||||
removed: string[],
|
||||
artworkOp?: ArtworkOp,
|
||||
): Promise<WriteSongTagsBatchResult> => {
|
||||
return ipcRenderer.invoke('write-song-tags-batch', filePaths, edits, removed, artworkOp);
|
||||
};
|
||||
|
||||
const onBatchProgress = (cb: (event: IpcRendererEvent, data: BatchProgress) => void) => {
|
||||
ipcRenderer.on('batch-progress', cb);
|
||||
};
|
||||
|
||||
const offBatchProgress = (cb: (event: IpcRendererEvent, data: BatchProgress) => void) => {
|
||||
ipcRenderer.removeListener('batch-progress', cb);
|
||||
};
|
||||
|
||||
const readLocalImage = (filePath: string): Promise<ReadLocalImageResult> => {
|
||||
return ipcRenderer.invoke('read-local-image', filePath);
|
||||
};
|
||||
|
||||
const openApplicationDirectory = async () => {
|
||||
return ipcRenderer.invoke('open-application-directory');
|
||||
};
|
||||
@@ -117,6 +155,7 @@ const rendererUpdateAvailable = (cb: (version: string) => void) => {
|
||||
};
|
||||
|
||||
export const utils = {
|
||||
cancelReadSongMetadata,
|
||||
checkForUpdates,
|
||||
customCssUpdatedListener,
|
||||
disableAutoUpdates,
|
||||
@@ -127,10 +166,14 @@ export const utils = {
|
||||
isMacOS,
|
||||
isWindows,
|
||||
mainMessageListener,
|
||||
offBatchProgress,
|
||||
onBatchProgress,
|
||||
openApplicationDirectory,
|
||||
openCustomCssFolder,
|
||||
openItem,
|
||||
playerErrorListener,
|
||||
readLocalImage,
|
||||
readSongMetadataBatch,
|
||||
rendererOpenCommandPalette,
|
||||
rendererOpenManageServers,
|
||||
rendererOpenReleaseNotes,
|
||||
@@ -143,6 +186,7 @@ export const utils = {
|
||||
setInputFocused,
|
||||
startPowerSaveBlocker,
|
||||
stopPowerSaveBlocker,
|
||||
writeSongTagsBatch,
|
||||
};
|
||||
|
||||
export type Utils = typeof utils;
|
||||
|
||||
Reference in New Issue
Block a user