Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(discord-plugin): handle album name padding if length < 2 #2903

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/plugins/discord/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,14 @@ export const backend = createBackend<
// @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
const hangulFillerUnicodeCharacter = '\u3164'; // This is an empty character
if (songInfo.title.length < 2) {
songInfo.title += hangulFillerUnicodeCharacter.repeat(
2 - songInfo.title.length,
);
}
if (songInfo.artist.length < 2) {
songInfo.artist += hangulFillerUnicodeCharacter.repeat(
2 - songInfo.title.length,
);
const paddedInfoKeys: (keyof SongInfo)[] = ['title', 'artist', 'album'];
for (const key of paddedInfoKeys) {
const keyLength = (songInfo[key] as string)?.length;
if (keyLength < 2) {
(songInfo[key] as string) += hangulFillerUnicodeCharacter.repeat(
2 - keyLength,
);
}
}

// see https://github.com/th-ch/youtube-music/issues/1664
Expand Down
Loading