From 8e88a49fac79dd8ede6544046eed77c6f81af2d4 Mon Sep 17 00:00:00 2001 From: github plz bring back DarkVIllager Date: Sun, 22 Sep 2024 11:29:06 +0200 Subject: [PATCH] feat(SoundCloud): add use presence name setting (#8743) Signed-off-by: github plz bring back DarkVIllager --- websites/S/SoundCloud/metadata.json | 8 +++++++- websites/S/SoundCloud/presence.ts | 17 +++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/websites/S/SoundCloud/metadata.json b/websites/S/SoundCloud/metadata.json index 8565989ef402..d0b7bbdc1962 100644 --- a/websites/S/SoundCloud/metadata.json +++ b/websites/S/SoundCloud/metadata.json @@ -27,7 +27,7 @@ "vi_VN": "SoundCloud là nền tảng phát nhạc và podcast trực tuyến nơi bạn có thể nghe hàng triệu bài hát từ khắp thế giới, hoặc tự đăng tải tác phẩm của riêng mình." }, "url": "soundcloud.com", - "version": "2.4.16", + "version": "2.5.0", "logo": "https://cdn.rcd.gg/PreMiD/websites/S/SoundCloud/assets/logo.png", "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/S/SoundCloud/assets/thumbnail.jpg", "color": "#FF7E30", @@ -76,6 +76,12 @@ "title": "Show Buttons", "icon": "fas fa-compress-arrows-alt", "value": true + }, + { + "id": "usePresenceName", + "title": "Show Title as Presence", + "icon": "fad fa-user-edit", + "value": false } ] } \ No newline at end of file diff --git a/websites/S/SoundCloud/presence.ts b/websites/S/SoundCloud/presence.ts index a4b1e9444d0b..6f7418ea1a7e 100644 --- a/websites/S/SoundCloud/presence.ts +++ b/websites/S/SoundCloud/presence.ts @@ -119,6 +119,7 @@ presence.on("UpdateData", async () => { showTimestamps, showCover, showButtons, + usePresenceName, newLang, ] = await Promise.all([ presence.getSetting("browse"), @@ -127,6 +128,7 @@ presence.on("UpdateData", async () => { presence.getSetting("timestamp"), presence.getSetting("cover"), presence.getSetting("buttons"), + presence.getSetting("usePresenceName"), presence.getSetting("lang").catch(() => "en"), ]), playing = Boolean(document.querySelector(".playControls__play.playing")); @@ -152,10 +154,17 @@ presence.on("UpdateData", async () => { } if ((playing || (!playing && !showBrowsing)) && showSong) { - presenceData.details = getElement( - ".playbackSoundBadge__titleLink > span:nth-child(2)" - ); - presenceData.state = getElement(".playbackSoundBadge__lightLink"); + if (!usePresenceName) { + presenceData.details = getElement( + ".playbackSoundBadge__titleLink > span:nth-child(2)" + ); + presenceData.state = getElement(".playbackSoundBadge__lightLink"); + } else { + presenceData.name = getElement( + ".playbackSoundBadge__titleLink > span:nth-child(2)" + ); + presenceData.details = getElement(".playbackSoundBadge__lightLink"); + } const timePassed = document.querySelector( "div.playbackTimeline__timePassed > span:nth-child(2)"