playlist phantom track matching added, updated search queries for efficiency

This commit is contained in:
2026-02-24 21:23:25 -05:00
parent ff7649600b
commit e192d4625e
31 changed files with 5222 additions and 316 deletions
+6
View File
@@ -13,10 +13,16 @@ export function GetAllAlbums():Promise<Array<library.Album>>;
export function GetAllArtists():Promise<Array<library.Artist>>;
export function GetAllGenresWithCounts():Promise<Array<library.GenreWithCount>>;
export function GetAllTracks():Promise<Array<library.Track>>;
export function GetTracksByGenre(arg1:string):Promise<Array<library.Track>>;
export function Scan():Promise<library.ScanMetrics>;
export function SearchTracks(arg1:string):Promise<Array<library.Track>>;
export function SetContext(arg1:context.Context):Promise<void>;
export function SetRescanHooks(arg1:library.RescanHooks):Promise<void>;
+12
View File
@@ -22,14 +22,26 @@ export function GetAllArtists() {
return window['go']['library']['Library']['GetAllArtists']();
}
export function GetAllGenresWithCounts() {
return window['go']['library']['Library']['GetAllGenresWithCounts']();
}
export function GetAllTracks() {
return window['go']['library']['Library']['GetAllTracks']();
}
export function GetTracksByGenre(arg1) {
return window['go']['library']['Library']['GetTracksByGenre'](arg1);
}
export function Scan() {
return window['go']['library']['Library']['Scan']();
}
export function SearchTracks(arg1) {
return window['go']['library']['Library']['SearchTracks'](arg1);
}
export function SetContext(arg1) {
return window['go']['library']['Library']['SetContext'](arg1);
}
+102
View File
@@ -40,6 +40,20 @@ export namespace library {
this.Name = source["Name"];
}
}
export class GenreWithCount {
Name: string;
TrackCount: number;
static createFrom(source: any = {}) {
return new GenreWithCount(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.Name = source["Name"];
this.TrackCount = source["TrackCount"];
}
}
export class RescanHooks {
@@ -159,6 +173,94 @@ export namespace library {
export namespace playlist {
export class CandidateTrack {
FilePath: string;
Title: string;
Artist: string;
Album: string;
Duration: string;
Score: number;
static createFrom(source: any = {}) {
return new CandidateTrack(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.FilePath = source["FilePath"];
this.Title = source["Title"];
this.Artist = source["Artist"];
this.Album = source["Album"];
this.Duration = source["Duration"];
this.Score = source["Score"];
}
}
export class PhantomMatch {
PhantomPath: string;
PhantomTitle: string;
Candidate: CandidateTrack;
static createFrom(source: any = {}) {
return new PhantomMatch(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.PhantomPath = source["PhantomPath"];
this.PhantomTitle = source["PhantomTitle"];
this.Candidate = this.convertValues(source["Candidate"], CandidateTrack);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class PhantomSearchResult {
AutoMatched: PhantomMatch[];
Unmatched: string[];
static createFrom(source: any = {}) {
return new PhantomSearchResult(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.AutoMatched = this.convertValues(source["AutoMatched"], PhantomMatch);
this.Unmatched = source["Unmatched"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class Summary {
ID: number;
Name: string;
+10
View File
@@ -11,18 +11,28 @@ export function CreatePlaylistWithTracks(arg1:string,arg2:Array<string>):Promise
export function DeletePlaylist(arg1:number):Promise<void>;
export function FindPhantomMatches(arg1:number,arg2:Array<string>):Promise<playlist.PhantomSearchResult>;
export function GetAllPlaylists():Promise<Array<playlist.Summary>>;
export function GetAllPlaylistsWithTracks():Promise<Array<playlist.WithTracks>>;
export function GetPhantomCandidates(arg1:number,arg2:string):Promise<Array<playlist.CandidateTrack>>;
export function GetPlaylistTracks(arg1:number):Promise<Array<playlist.Track>>;
export function ImportPlaylist(arg1:string):Promise<playlist.Summary>;
export function RemovePhantomTracks(arg1:number,arg2:Array<string>):Promise<void>;
export function RemoveTracksFromPlaylist(arg1:number,arg2:Array<number>):Promise<void>;
export function RenamePlaylist(arg1:number,arg2:string):Promise<void>;
export function ResolvePhantomTracks(arg1:number,arg2:Record<string, string>):Promise<void>;
export function RestoreAllPlaylists():Promise<void>;
export function SearchLibrary(arg1:string):Promise<Array<playlist.CandidateTrack>>;
export function SetContext(arg1:context.Context):Promise<void>;
+20
View File
@@ -18,6 +18,10 @@ export function DeletePlaylist(arg1) {
return window['go']['playlist']['Service']['DeletePlaylist'](arg1);
}
export function FindPhantomMatches(arg1, arg2) {
return window['go']['playlist']['Service']['FindPhantomMatches'](arg1, arg2);
}
export function GetAllPlaylists() {
return window['go']['playlist']['Service']['GetAllPlaylists']();
}
@@ -26,6 +30,10 @@ export function GetAllPlaylistsWithTracks() {
return window['go']['playlist']['Service']['GetAllPlaylistsWithTracks']();
}
export function GetPhantomCandidates(arg1, arg2) {
return window['go']['playlist']['Service']['GetPhantomCandidates'](arg1, arg2);
}
export function GetPlaylistTracks(arg1) {
return window['go']['playlist']['Service']['GetPlaylistTracks'](arg1);
}
@@ -34,6 +42,10 @@ export function ImportPlaylist(arg1) {
return window['go']['playlist']['Service']['ImportPlaylist'](arg1);
}
export function RemovePhantomTracks(arg1, arg2) {
return window['go']['playlist']['Service']['RemovePhantomTracks'](arg1, arg2);
}
export function RemoveTracksFromPlaylist(arg1, arg2) {
return window['go']['playlist']['Service']['RemoveTracksFromPlaylist'](arg1, arg2);
}
@@ -42,10 +54,18 @@ export function RenamePlaylist(arg1, arg2) {
return window['go']['playlist']['Service']['RenamePlaylist'](arg1, arg2);
}
export function ResolvePhantomTracks(arg1, arg2) {
return window['go']['playlist']['Service']['ResolvePhantomTracks'](arg1, arg2);
}
export function RestoreAllPlaylists() {
return window['go']['playlist']['Service']['RestoreAllPlaylists']();
}
export function SearchLibrary(arg1) {
return window['go']['playlist']['Service']['SearchLibrary'](arg1);
}
export function SetContext(arg1) {
return window['go']['playlist']['Service']['SetContext'](arg1);
}
View File
Vendored Regular → Executable
View File
View File