Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 3 additions & 1 deletion src/plugins/discord/discord-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -109,7 +111,7 @@ export class DiscordService {

// Handle paused state display
if (songInfo.isPaused) {
activityInfo.largeImageText = '⏸';
activityInfo.largeImageText = '⏸';

This comment was marked as resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not sure why my editor insisted on changing that when i saved, but just in case there was some significance to the zero width char ive reverted that one line

} else if (
!config.hideDurationLeft &&
songInfo.songDuration > 0 &&
Expand Down
5 changes: 4 additions & 1 deletion src/providers/song-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface SongInfo {
title: string;
alternativeTitle?: string;
artist: string;
artistUrl?: string;
views: number;
uploadDate?: string;
imageSrc?: string | null;
Expand Down Expand Up @@ -72,6 +73,7 @@ const handleData = async (
title: '',
alternativeTitle: '',
artist: '',
artistUrl: '',
views: 0,
uploadDate: '',
imageSrc: '',
Expand All @@ -93,6 +95,7 @@ const handleData = async (
songInfo.url = microformat.urlCanonical?.split('&')[0];
songInfo.playlistId =
new URL(microformat.urlCanonical).searchParams.get('list') ?? '';
songInfo.artistUrl = `https://music.youtube.com/channel/${microformat.pageOwnerDetails.externalChannelId}`;
// Used for options.resumeOnStart
config.set('url', microformat.urlCanonical);
songInfo.alternativeTitle = microformat.linkAlternates.find(
Expand All @@ -110,7 +113,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':
Expand Down