Skip to content

Commit

Permalink
fix(Disney+): broken timestamp (#8620)
Browse files Browse the repository at this point in the history
* fix(Disney+): broken timestamp

* chore(Disney+): bump version

* fix(Disney+): null check

Co-authored-by: Dark_Ville <[email protected]>
Signed-off-by: Slowlife <[email protected]>

---------

Signed-off-by: Slowlife <[email protected]>
Co-authored-by: Dark_Ville <[email protected]>
  • Loading branch information
Slowlife01 and Dark_Ville authored Jul 29, 2024
1 parent 8925018 commit 365f6c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion websites/D/Disney+/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"*://*.disneyplus.com/*",
"*://*.hotstar.com/*"
],
"version": "1.6.1",
"version": "1.6.2",
"logo": "https://cdn.rcd.gg/PreMiD/websites/D/Disney+/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/D/Disney+/assets/thumbnail.png",
"color": "#233778",
Expand Down
23 changes: 9 additions & 14 deletions websites/D/Disney+/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,17 @@ presence.on("UpdateData", async () => {
presenceData.state =
document.querySelector(".subtitle-field")?.textContent;

const paused = !!document.querySelector("[aria-label='Play']");
const paused = !!document.querySelector("[aria-label='Play']"),
timeRemaining = document.querySelector(
".time-remaining-label"
)?.textContent;

presenceData.smallImageKey = paused ? Assets.Pause : Assets.Play;
presenceData.smallImageText = paused ? strings.pause : strings.play;
const stamps = document
.querySelectorAll('[class="slider-container"]')[1]
.getAttribute("aria-valuetext")
.split("of ");
if (!paused && !isNaN(Number(stamps[1]))) {
const endDateObj = new Date();
endDateObj.setSeconds(
endDateObj.getSeconds() +
presence.timestampFromFormat(
document.querySelector(".time-remaining-label").textContent
)
);
presenceData.endTimestamp = endDateObj.getTime();

if (!paused && timeRemaining) {
presenceData.endTimestamp =
Date.now() / 1000 + presence.timestampFromFormat(timeRemaining);
}
} else presenceData.details = "Watching content";

Expand Down

0 comments on commit 365f6c9

Please sign in to comment.