mirror of
https://github.com/litruv/AudioSort.git
synced 2026-07-24 10:46:03 +10:00
fix file by id in the parent field
This commit is contained in:
@@ -225,6 +225,9 @@ export class MainApp {
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.libraryScan, async () => this.requireLibrary().scanLibrary());
|
||||
ipcMain.handle(IPC_CHANNELS.libraryList, async () => this.requireLibrary().listFiles());
|
||||
ipcMain.handle(IPC_CHANNELS.libraryGetById, async (_event: IpcMainInvokeEvent, fileId: number) =>
|
||||
this.requireLibrary().getFileById(fileId)
|
||||
);
|
||||
ipcMain.handle(IPC_CHANNELS.libraryDuplicates, async () => this.requireLibrary().listDuplicates());
|
||||
ipcMain.handle(IPC_CHANNELS.searchQuery, async (_event: IpcMainInvokeEvent, query: string) =>
|
||||
this.requireSearch().search(query)
|
||||
|
||||
@@ -214,6 +214,20 @@ export class LibraryService {
|
||||
return this.database.listFiles();
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to resolve a file summary by id. Returns null when the record no longer exists.
|
||||
*/
|
||||
public getFileById(fileId: number): AudioFileSummary | null {
|
||||
try {
|
||||
return this.database.getFileById(fileId);
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
console.warn(`Failed to resolve file by id ${fileId}:`, error.message);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns groups of files that have identical checksums (potential duplicates).
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user