added db query optimizations to playlists view, added caching

This commit is contained in:
2026-02-17 11:39:17 -05:00
parent 93679761af
commit 50718fd633
13 changed files with 542 additions and 110 deletions
+32
View File
@@ -91,6 +91,38 @@ export namespace playlist {
this.Duration = source["Duration"];
}
}
export class WithTracks {
Summary: Summary;
Tracks: Track[];
static createFrom(source: any = {}) {
return new WithTracks(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.Summary = this.convertValues(source["Summary"], Summary);
this.Tracks = this.convertValues(source["Tracks"], Track);
}
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;
}
}
}
+2
View File
@@ -11,6 +11,8 @@ export function CreatePlaylistWithTracks(arg1:string,arg2:Array<string>):Promise
export function GetAllPlaylists():Promise<Array<playlist.Summary>>;
export function GetAllPlaylistsWithTracks():Promise<Array<playlist.WithTracks>>;
export function GetPlaylistTracks(arg1:number):Promise<Array<playlist.Track>>;
export function SetContext(arg1:context.Context):Promise<void>;
+4
View File
@@ -18,6 +18,10 @@ export function GetAllPlaylists() {
return window['go']['playlist']['Service']['GetAllPlaylists']();
}
export function GetAllPlaylistsWithTracks() {
return window['go']['playlist']['Service']['GetAllPlaylistsWithTracks']();
}
export function GetPlaylistTracks(arg1) {
return window['go']['playlist']['Service']['GetPlaylistTracks'](arg1);
}
View File
Vendored Regular → Executable
View File
View File