mirror of
https://github.com/informaticker/discord-jellyfin-bot.git
synced 2024-11-24 18:41:57 +01:00
Include artist names in song/album search results (#241)
This commit is contained in:
parent
18af088774
commit
41ecfea68d
@ -17,10 +17,14 @@ export class AlbumSearchHint extends SearchHint {
|
||||
'Unable to construct playlist search hint, required properties were undefined',
|
||||
);
|
||||
}
|
||||
var artist = ""
|
||||
if(hint.AlbumArtist) {
|
||||
artist = hint.AlbumArtist + " - "
|
||||
}
|
||||
|
||||
return new AlbumSearchHint(
|
||||
hint.Id,
|
||||
trimStringToFixedLength(hint.Name, 50),
|
||||
trimStringToFixedLength(artist + hint.Name, 70),
|
||||
hint.RunTimeTicks / 10000,
|
||||
);
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ export class SearchHint {
|
||||
static constructFromHint(hint: JellyfinSearchHint) {
|
||||
const schema = z.object({
|
||||
Id: z.string(),
|
||||
Artists: z.array(z.string()),
|
||||
Name: z.string(),
|
||||
RunTimeTicks: z.number(),
|
||||
});
|
||||
@ -44,10 +45,18 @@ export class SearchHint {
|
||||
)}`,
|
||||
);
|
||||
}
|
||||
|
||||
var artist = "";
|
||||
if (result.data.Artists !== null) {
|
||||
artist = result.data.Artists[0]
|
||||
if (result.data.Artists.length > 1) {
|
||||
artist += ",... - "
|
||||
} else {
|
||||
artist += " - "
|
||||
}
|
||||
}
|
||||
return new SearchHint(
|
||||
result.data.Id,
|
||||
trimStringToFixedLength(result.data.Name, 50),
|
||||
trimStringToFixedLength(artist + result.data.Name, 70),
|
||||
result.data.RunTimeTicks / 10000,
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user