mirror of
https://github.com/informaticker/discord-jellyfin-bot.git
synced 2024-11-24 18:41:57 +01:00
🐛 Fix missing remote images for albums (#131)
This commit is contained in:
parent
2c15e38b94
commit
0130115be8
@ -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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user