diff --git a/src/plugins/discord/discord-service.ts b/src/plugins/discord/discord-service.ts index 4cdc3ab7aa..65d5344680 100644 --- a/src/plugins/discord/discord-service.ts +++ b/src/plugins/discord/discord-service.ts @@ -99,7 +99,9 @@ export class DiscordService { const activityInfo: SetActivity = { type: ActivityType.Listening, details: truncateString(songInfo.title, 128), // Song title + detailsUrl: songInfo.url, state: truncateString(songInfo.artist, 128), // Artist name + stateUrl: songInfo.artistUrl, largeImageKey: songInfo.imageSrc ?? undefined, largeImageText: songInfo.album ? truncateString(songInfo.album, 128) diff --git a/src/providers/song-info.ts b/src/providers/song-info.ts index 50ea6b5c2c..1c77ed3045 100644 --- a/src/providers/song-info.ts +++ b/src/providers/song-info.ts @@ -30,6 +30,7 @@ export interface SongInfo { title: string; alternativeTitle?: string; artist: string; + artistUrl?: string; views: number; uploadDate?: string; imageSrc?: string | null; @@ -72,6 +73,7 @@ const handleData = async ( title: '', alternativeTitle: '', artist: '', + artistUrl: '', views: 0, uploadDate: '', imageSrc: '', @@ -93,6 +95,9 @@ const handleData = async ( songInfo.url = microformat.urlCanonical?.split('&')[0]; songInfo.playlistId = new URL(microformat.urlCanonical).searchParams.get('list') ?? ''; + if (microformat.pageOwnerDetails?.externalChannelId) { + songInfo.artistUrl = `https://music.youtube.com/channel/${microformat.pageOwnerDetails.externalChannelId}`; + } // Used for options.resumeOnStart config.set('url', microformat.urlCanonical); songInfo.alternativeTitle = microformat.linkAlternates.find( @@ -110,7 +115,7 @@ const handleData = async ( songInfo.elapsedSeconds = videoDetails.elapsedSeconds; songInfo.isPaused = videoDetails.isPaused; songInfo.videoId = videoDetails.videoId; - songInfo.album = data?.videoDetails?.album; // Will be undefined if video exist + songInfo.album = videoDetails.album; // Will be undefined if video exist switch (videoDetails?.musicVideoType) { case 'MUSIC_VIDEO_TYPE_ATV':