🐛 Fix missing remote images for albums (#131)

This commit is contained in:
Manuel 2023-03-26 00:59:20 +01:00 committed by GitHub
parent 2c15e38b94
commit 0130115be8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 8 deletions

View File

@ -17,10 +17,17 @@ export class AlbumSearchHint extends SearchHint {
override async toTracks(
searchService: JellyfinSearchService,
): Promise<Track[]> {
const remoteImages = await searchService.getRemoteImageById(this.id);
const albumItems = await searchService.getAlbumItems(this.id);
const tracks = albumItems.map(async (x) =>
(await x.toTracks(searchService)).find((x) => x !== null),
const tracks = await Promise.all(
albumItems.map(async (x) =>
(await x.toTracks(searchService)).find((x) => x !== null),
),
);
return await Promise.all(tracks);
return tracks.map((track): Track => {
track.remoteImages = remoteImages;
return track;
});
}
}

View File

@ -18,10 +18,7 @@ export class SearchHint {
}
async toTracks(searchService: JellyfinSearchService): Promise<Track[]> {
const remoteImages = await searchService.getRemoteImageById(this.id);
return [
new Track(this.id, this.name, this.runtimeInMilliseconds, remoteImages),
];
return [new Track(this.id, this.name, this.runtimeInMilliseconds, {})];
}
getId(): string {

View File

@ -25,7 +25,7 @@ export class Track {
/**
* A result object that contains a collection of images that are available outside the current network.
*/
readonly remoteImages?: RemoteImageResult;
remoteImages?: RemoteImageResult;
constructor(
id: string,