mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
fix(discord-plugin): handle album name padding if length < 2 (#2903)
This commit is contained in:
@ -154,15 +154,14 @@ export const backend = createBackend<
|
|||||||
// @see https://discord.com/developers/docs/topics/gateway#activity-object
|
// @see https://discord.com/developers/docs/topics/gateway#activity-object
|
||||||
// not all options are transfered through https://github.com/discordjs/RPC/blob/6f83d8d812c87cb7ae22064acd132600407d7d05/src/client.js#L518-530
|
// not all options are transfered through https://github.com/discordjs/RPC/blob/6f83d8d812c87cb7ae22064acd132600407d7d05/src/client.js#L518-530
|
||||||
const hangulFillerUnicodeCharacter = '\u3164'; // This is an empty character
|
const hangulFillerUnicodeCharacter = '\u3164'; // This is an empty character
|
||||||
if (songInfo.title.length < 2) {
|
const paddedInfoKeys: (keyof SongInfo)[] = ['title', 'artist', 'album'];
|
||||||
songInfo.title += hangulFillerUnicodeCharacter.repeat(
|
for (const key of paddedInfoKeys) {
|
||||||
2 - songInfo.title.length,
|
const keyLength = (songInfo[key] as string)?.length;
|
||||||
);
|
if (keyLength < 2) {
|
||||||
}
|
(songInfo[key] as string) += hangulFillerUnicodeCharacter.repeat(
|
||||||
if (songInfo.artist.length < 2) {
|
2 - keyLength,
|
||||||
songInfo.artist += hangulFillerUnicodeCharacter.repeat(
|
);
|
||||||
2 - songInfo.title.length,
|
}
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// see https://github.com/th-ch/youtube-music/issues/1664
|
// see https://github.com/th-ch/youtube-music/issues/1664
|
||||||
|
|||||||
Reference in New Issue
Block a user