fix(13-02): resolve phantom playlist tracks using M3U8 paths after scan

- Add ScanHooks callback struct to library package (follows RemovalHooks pattern)
- Move phantom resolution from library to playlist service via hook
- New ResolvePhantomTracksAfterScan reads M3U8 files and resolves paths
  against current audio_files using multi-root resolution
- Handles pre-existing phantoms (match by M3U8 position) and new ones
  (match by phantom_file_path)
- Delete old resolvePhantomTracks method that required phantom_file_path
- Wire ScanHooks in app.go OnStartup
This commit is contained in:
2026-03-16 12:47:42 -04:00
parent 93262b9ae0
commit 9f595b7ac1
8 changed files with 356 additions and 53 deletions
+2
View File
@@ -76,4 +76,6 @@ export function SetRemovalHooks(arg1:library.RemovalHooks):Promise<void>;
export function SetRescanHooks(arg1:library.RescanHooks):Promise<void>;
export function SetScanHooks(arg1:library.ScanHooks):Promise<void>;
export function SoftScanAllLibraries():Promise<void>;
+4
View File
@@ -146,6 +146,10 @@ export function SetRescanHooks(arg1) {
return window['go']['library']['Library']['SetRescanHooks'](arg1);
}
export function SetScanHooks(arg1) {
return window['go']['library']['Library']['SetScanHooks'](arg1);
}
export function SoftScanAllLibraries() {
return window['go']['library']['Library']['SoftScanAllLibraries']();
}
+12
View File
@@ -134,6 +134,18 @@ export namespace library {
}
}
export class ScanHooks {
static createFrom(source: any = {}) {
return new ScanHooks(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
}
}
export class ScanWarning {
filePath: string;
phase: string;
+2
View File
@@ -45,6 +45,8 @@ export function RenamePlaylist(arg1:number,arg2:string):Promise<void>;
export function ResolvePhantomTracks(arg1:number,arg2:Record<string, string>):Promise<void>;
export function ResolvePhantomTracksAfterScan():Promise<void>;
export function RestoreAllPlaylists():Promise<void>;
export function SearchLibrary(arg1:string):Promise<Array<playlist.CandidateTrack>>;
+4
View File
@@ -86,6 +86,10 @@ export function ResolvePhantomTracks(arg1, arg2) {
return window['go']['playlist']['Service']['ResolvePhantomTracks'](arg1, arg2);
}
export function ResolvePhantomTracksAfterScan() {
return window['go']['playlist']['Service']['ResolvePhantomTracksAfterScan']();
}
export function RestoreAllPlaylists() {
return window['go']['playlist']['Service']['RestoreAllPlaylists']();
}