localMusicSheet.ts (4173d3ebc9a6802c920c4cc6e66072aae44c26be) localMusicSheet.ts (483fe5856044df91771f8cf65aeb02b7e2f61fad)
1import {
2 internalSerializeKey,
3 StorageKeys,
4 supportLocalMediaType,
5} from '@/constants/commonConst';
6import mp3Util, {IBasicMeta} from '@/native/mp3Util';
7import {
8 getInternalData,

--- 76 unchanged lines hidden (view full) ---

85 let newSheet = [...localSheet];
86 if (idx !== -1) {
87 const localMusicItem = localSheet[idx];
88 newSheet.splice(idx, 1);
89 const localPath =
90 musicItem[internalSerializeKey]?.localPath ??
91 localMusicItem[internalSerializeKey]?.localPath;
92 if (deleteOriginalFile && localPath) {
1import {
2 internalSerializeKey,
3 StorageKeys,
4 supportLocalMediaType,
5} from '@/constants/commonConst';
6import mp3Util, {IBasicMeta} from '@/native/mp3Util';
7import {
8 getInternalData,

--- 76 unchanged lines hidden (view full) ---

85 let newSheet = [...localSheet];
86 if (idx !== -1) {
87 const localMusicItem = localSheet[idx];
88 newSheet.splice(idx, 1);
89 const localPath =
90 musicItem[internalSerializeKey]?.localPath ??
91 localMusicItem[internalSerializeKey]?.localPath;
92 if (deleteOriginalFile && localPath) {
93 await unlink(localPath);
93 try {
94 await unlink(localPath);
95 } catch (e: any) {
96 if (e.message !== 'File does not exist') {
97 throw e;
98 }
99 }
94 }
95 }
96 localSheet = newSheet;
97 localSheetStateMapper.notify();
98}
99
100function parseFilename(fn: string): Partial<IMusic.IMusicItem> | null {
101 const data = fn.slice(0, fn.lastIndexOf('.')).split('@');

--- 154 unchanged lines hidden ---
100 }
101 }
102 localSheet = newSheet;
103 localSheetStateMapper.notify();
104}
105
106function parseFilename(fn: string): Partial<IMusic.IMusicItem> | null {
107 const data = fn.slice(0, fn.lastIndexOf('.')).split('@');

--- 154 unchanged lines hidden ---