From 4d63705db9c09a37ca67a1e32a0ed1a542dfede2 Mon Sep 17 00:00:00 2001 From: veryCrunchy Date: Tue, 22 Oct 2024 23:38:10 +0200 Subject: [PATCH 1/4] fix(Prime Video): use built in getTimestamps function --- websites/P/Prime Video/presence.ts | 38 ++++++++++-------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/websites/P/Prime Video/presence.ts b/websites/P/Prime Video/presence.ts index 188225715f03..490fd8133744 100644 --- a/websites/P/Prime Video/presence.ts +++ b/websites/P/Prime Video/presence.ts @@ -1,24 +1,12 @@ const presence = new Presence({ - clientId: "705139844883677224", - }), + clientId: "705139844883677224", +}), strings = presence.getStrings({ paused: "general.paused", playing: "general.playing", }), browsingTimestamp = Math.floor(Date.now() / 1000); -/** - * Get Timestamps - * @param {Number} videoTime Current video time seconds - * @param {Number} videoDuration Video duration seconds - */ -function getTimestamps(videoTime: number, videoDuration: number): number[] { - const startTime = Date.now(); - return [ - Math.floor(startTime / 1000), - Math.floor(startTime / 1000) - videoTime + videoDuration, - ]; -} presence.on("UpdateData", async () => { const presenceData: PresenceData = { @@ -28,10 +16,10 @@ presence.on("UpdateData", async () => { }; presenceData.startTimestamp = browsingTimestamp; const title: string = - document.querySelector( - ".webPlayerSDKUiContainer > div > div > div > div:nth-child(2) > div > div:nth-child(4) > div > div:nth-child(2) > div:nth-child(2) > div > div > div > h1" - )?.textContent || - document.querySelector(".atvwebplayersdk-title-text")?.textContent, + document.querySelector( + ".webPlayerSDKUiContainer > div > div > div > div:nth-child(2) > div > div:nth-child(4) > div > div:nth-child(2) > div:nth-child(2) > div > div > div > h1" + )?.textContent || + document.querySelector(".atvwebplayersdk-title-text")?.textContent, title2: string = document.querySelector(".av-detail-section > div > h1")?.textContent || document.querySelector( @@ -67,9 +55,9 @@ presence.on("UpdateData", async () => { presenceData.smallImageText = (await strings).paused; delete presenceData.startTimestamp; } else { - const [startTimestamp, endTimestamp] = getTimestamps( - Math.floor(video.currentTime), - Math.floor(video.duration) + const [startTimestamp, endTimestamp] = presence.getTimestamps( + video.currentTime, + video.duration ); presenceData.startTimestamp = startTimestamp; presenceData.endTimestamp = endTimestamp; @@ -83,9 +71,9 @@ presence.on("UpdateData", async () => { presenceData.smallImageText = (await strings).paused; delete presenceData.startTimestamp; } else { - const [startTimestamp, endTimestamp] = getTimestamps( - Math.floor(video.currentTime), - Math.floor(video.duration) + const [startTimestamp, endTimestamp] = presence.getTimestamps( + video.currentTime, + video.duration, ); presenceData.startTimestamp = startTimestamp; presenceData.endTimestamp = endTimestamp; @@ -119,7 +107,7 @@ presence.on("UpdateData", async () => { .split(/[”"]/); presenceData.smallImageKey = Assets.Search; } - + console.log(presenceData); if (presenceData.details) presence.setActivity(presenceData); else presence.setActivity(); }); From 1afcf087b12437f699a6f81ea0525cc689530a2e Mon Sep 17 00:00:00 2001 From: veryCrunchy Date: Tue, 22 Oct 2024 23:41:33 +0200 Subject: [PATCH 2/4] chore: remove stray console.log --- websites/P/Prime Video/presence.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/websites/P/Prime Video/presence.ts b/websites/P/Prime Video/presence.ts index 490fd8133744..185974eb36e1 100644 --- a/websites/P/Prime Video/presence.ts +++ b/websites/P/Prime Video/presence.ts @@ -107,7 +107,6 @@ presence.on("UpdateData", async () => { .split(/[”"]/); presenceData.smallImageKey = Assets.Search; } - console.log(presenceData); if (presenceData.details) presence.setActivity(presenceData); else presence.setActivity(); }); From 0b861f71f9fc0cf96cafda2cfcf21844b6e750c1 Mon Sep 17 00:00:00 2001 From: veryCrunchy Date: Wed, 23 Oct 2024 00:02:37 +0200 Subject: [PATCH 3/4] chore: format --- websites/A/Amazon Kindle/metadata.json | 2 +- websites/K/Kick/presence.ts | 3 +-- websites/P/Prime Video/presence.ts | 15 +++++++-------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/websites/A/Amazon Kindle/metadata.json b/websites/A/Amazon Kindle/metadata.json index e3f1468773fa..17ff533cbf1b 100644 --- a/websites/A/Amazon Kindle/metadata.json +++ b/websites/A/Amazon Kindle/metadata.json @@ -20,4 +20,4 @@ "tags": [ "books" ] -} +} \ No newline at end of file diff --git a/websites/K/Kick/presence.ts b/websites/K/Kick/presence.ts index 58eca33beaf3..d9d14399c19f 100644 --- a/websites/K/Kick/presence.ts +++ b/websites/K/Kick/presence.ts @@ -193,7 +193,6 @@ function getPageData( buttons, }; } else if (streamer && titleEl?.includes("VOD")) { - const smallImageKey = ""; return { details: document.querySelector( 'meta[name="description"]' @@ -202,7 +201,7 @@ function getPageData( largeImageKey: document.querySelector(".owner-avatar img") ?.src, - smallImageKey, + smallImageKey: "", buttons: [ { label: "Watch Stream VOD", diff --git a/websites/P/Prime Video/presence.ts b/websites/P/Prime Video/presence.ts index 5a76d8fdfb0f..6aa5aee61b64 100644 --- a/websites/P/Prime Video/presence.ts +++ b/websites/P/Prime Video/presence.ts @@ -1,13 +1,12 @@ const presence = new Presence({ - clientId: "705139844883677224", -}), + clientId: "705139844883677224", + }), strings = presence.getStrings({ paused: "general.paused", playing: "general.playing", }), browsingTimestamp = Math.floor(Date.now() / 1000); - presence.on("UpdateData", async () => { const presenceData: PresenceData = { type: ActivityType.Watching, @@ -16,10 +15,10 @@ presence.on("UpdateData", async () => { }; presenceData.startTimestamp = browsingTimestamp; const title: string = - document.querySelector( - ".webPlayerSDKUiContainer > div > div > div > div:nth-child(2) > div > div:nth-child(4) > div > div:nth-child(2) > div:nth-child(2) > div > div > div > h1" - )?.textContent || - document.querySelector(".atvwebplayersdk-title-text")?.textContent, + document.querySelector( + ".webPlayerSDKUiContainer > div > div > div > div:nth-child(2) > div > div:nth-child(4) > div > div:nth-child(2) > div:nth-child(2) > div > div > div > h1" + )?.textContent || + document.querySelector(".atvwebplayersdk-title-text")?.textContent, title2: string = document.querySelector(".av-detail-section > div > h1")?.textContent || document.querySelector( @@ -75,7 +74,7 @@ presence.on("UpdateData", async () => { } else { const [startTimestamp, endTimestamp] = presence.getTimestamps( video.currentTime, - video.duration, + video.duration ); [presenceData.startTimestamp, presenceData.endTimestamp] = [ startTimestamp, From 451c00e74b0d9ee7bcfb4061d552ede5fb03ae70 Mon Sep 17 00:00:00 2001 From: veryCrunchy Date: Wed, 23 Oct 2024 00:02:57 +0200 Subject: [PATCH 4/4] chore: bump version --- websites/P/Prime Video/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/websites/P/Prime Video/metadata.json b/websites/P/Prime Video/metadata.json index 67a2b17c4c6b..e334f5d3230f 100644 --- a/websites/P/Prime Video/metadata.json +++ b/websites/P/Prime Video/metadata.json @@ -20,7 +20,7 @@ }, "url": "www.primevideo.com", "regExp": "(([a-z0-9-]+[.])*amazon([.][a-z]+)+([/](-[/]([a-z0-9]+)[/])?(Prime-Video|Prime-Instant-Video|Amazon-Video|gp[/]video)?)?)|([a-z0-9-]+[.])*primevideo([.][a-z]+)+([/]?)?", - "version": "2.1.27", + "version": "2.1.28", "logo": "https://cdn.rcd.gg/PreMiD/websites/P/Prime%20Video/assets/logo.png", "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/P/Prime%20Video/assets/thumbnail.jpg", "color": "#FFFFFF",