mirror of
https://github.com/informaticker/discord-jellyfin-bot.git
synced 2024-11-25 02:51: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(
|
override async toTracks(
|
||||||
searchService: JellyfinSearchService,
|
searchService: JellyfinSearchService,
|
||||||
): Promise<Track[]> {
|
): Promise<Track[]> {
|
||||||
|
const remoteImages = await searchService.getRemoteImageById(this.id);
|
||||||
|
|
||||||
const albumItems = await searchService.getAlbumItems(this.id);
|
const albumItems = await searchService.getAlbumItems(this.id);
|
||||||
const tracks = albumItems.map(async (x) =>
|
const tracks = await Promise.all(
|
||||||
|
albumItems.map(async (x) =>
|
||||||
(await x.toTracks(searchService)).find((x) => x !== null),
|
(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[]> {
|
async toTracks(searchService: JellyfinSearchService): Promise<Track[]> {
|
||||||
const remoteImages = await searchService.getRemoteImageById(this.id);
|
return [new Track(this.id, this.name, this.runtimeInMilliseconds, {})];
|
||||||
return [
|
|
||||||
new Track(this.id, this.name, this.runtimeInMilliseconds, remoteImages),
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getId(): string {
|
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.
|
* A result object that contains a collection of images that are available outside the current network.
|
||||||
*/
|
*/
|
||||||
readonly remoteImages?: RemoteImageResult;
|
remoteImages?: RemoteImageResult;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
id: string,
|
id: string,
|
||||||
|
Loading…
Reference in New Issue
Block a user