Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Plex): fix it showing listening when watching #9270

Merged
merged 6 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion websites/P/Plex/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"url": "www.plex.tv",
"regExp": "(([a-z0-9-]+[.])*plex[.]tv[/])|( *[/]web[/]index[.]html#)",
"version": "1.10.5",
"version": "1.10.6",
"logo": "https://cdn.rcd.gg/PreMiD/websites/P/Plex/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/P/Plex/assets/thumbnail.png",
"color": "#d78c14",
Expand Down
45 changes: 21 additions & 24 deletions websites/P/Plex/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,18 +229,18 @@
)
}

if (cover && navigator.mediaSession.metadata?.artwork[0]?.src) {
const art = navigator.mediaSession.metadata.artwork?.[0]?.src
presenceData.largeImageKey = art?.match(
/(\d+)(?<!10)-(\d+)(192-168)?(?<!172-(1[6-9]|2\d|3[01]))-(\d+)\.(\d+)/g,
)?.[0] // Checks if it's a private ip, since u can't access that to use as a large/smallimagekey.
? ActivityAssets.Logo // If it's a private ip, just use the logo.
: await getShortURL(
art
.replace(/width=\d{1,3}/, 'width=1024')
.replace(/height=\d{1,3}/, 'height=1024'),
)
}
if (cover && navigator.mediaSession.metadata?.artwork[0].src) {

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 6 spaces but found 3 tabs.
const art = navigator.mediaSession.metadata.artwork?.[0]?.src;

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 8 spaces but found 4 tabs.

Check failure

Code scanning / ESLint

Require or disallow semicolons instead of ASI Error

Extra semicolon.
presenceData.largeImageKey = art?.match(

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 8 spaces but found 4 tabs.
/(\d+)(?<!10)-(\d+)(192-168)?(?<!172-(1[6-9]|2\d|3[0-1]))-(\d+)\.(\d+)/gm

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 10 spaces but found 5 tabs.

Check failure

Code scanning / ESLint

disallow unnecessary character ranges Error

Unexpected unnecessary character ranges. The hyphen is unnecessary.

Check warning

Code scanning / ESLint

disallow unnecessary regex flags Warning

The 'm' flag is unnecessary because the pattern does not contain start (^) or end ($) assertions.
)?.[0] // Checks if it's a private ip, since u can't access that to use as a large/smallimagekey.

Check failure

Code scanning / ESLint

Require or disallow trailing commas Error

Missing trailing comma.

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 8 spaces but found 4 tabs.
? ActivityAssets.Logo // If it's a private ip, just use the logo.

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 10 spaces but found 5 tabs.
: await getShortURL(

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 10 spaces but found 5 tabs.
art

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 12 spaces but found 7 tabs.
.replace(/width=[0-9]{1,3}/, "width=1024")

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 14 spaces but found 8 tabs.

Check failure

Code scanning / ESLint

enforce using `\d` Error

Unexpected character class '[0-9]'. Use '\d' instead.

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.
.replace(/height=[0-9]{1,3}/, "height=1024")

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 14 spaces but found 8 tabs.

Check failure

Code scanning / ESLint

enforce using `\d` Error

Unexpected character class '[0-9]'. Use '\d' instead.

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.
);

Check failure

Code scanning / ESLint

Require or disallow trailing commas Error

Missing trailing comma.

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 10 spaces but found 6 tabs.

Check failure

Code scanning / ESLint

Require or disallow semicolons instead of ASI Error

Extra semicolon.
}

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 6 spaces but found 3 tabs.

presenceData.smallImageKey = media?.paused ? Assets.Pause : Assets.Play
presenceData.smallImageText = media?.paused ? 'Paused' : 'Playing'
Expand All @@ -260,18 +260,15 @@
presenceData.details = title
else presenceData.name = title ?? ''

presenceData.state = subTitle

if (
(!navigator.mediaSession.metadata?.artist
&& !navigator.mediaSession.metadata?.album)
|| !!document.querySelector('.application.show-video-player')
) {
presenceData.type = ActivityType.Watching
}
else {
presenceData.type = ActivityType.Listening
}
presenceData.state = subTitle;

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 6 spaces but found 3 tabs.

Check failure

Code scanning / ESLint

Require or disallow semicolons instead of ASI Error

Extra semicolon.
if (

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 6 spaces but found 3 tabs.
(!navigator.mediaSession.metadata?.artist &&

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 8 spaces but found 4 tabs.

Check failure

Code scanning / ESLint

Enforce consistent linebreak style for operators Error

'&&' should be placed at the beginning of the line.
!navigator.mediaSession.metadata?.album) ||

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Indentation for binary operators Error

Expected indentation of 6 spaces

Check failure

Code scanning / ESLint

Enforce consistent linebreak style for operators Error

'||' should be placed at the beginning of the line.
!!document.querySelector(".application.show-video-player") ||

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Indentation for binary operators Error

Expected indentation of 5 spaces

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.

Check failure

Code scanning / ESLint

Enforce consistent linebreak style for operators Error

'||' should be placed at the beginning of the line.
!!document.querySelector("video")

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce the consistent use of either backticks, double, or single quotes Error

Strings must use singlequote.
)

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 6 spaces but found 3 tabs.
presenceData.type = ActivityType.Watching;

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 8 spaces but found 4 tabs.

Check failure

Code scanning / ESLint

Enforce Anthony's style of curly bracket Error

Expect curly brackets

Check failure

Code scanning / ESLint

Require or disallow semicolons instead of ASI Error

Extra semicolon.
else presenceData.type = ActivityType.Listening;

Check failure

Code scanning / ESLint

Disallow all tabs Error

Unexpected tab character.

Check failure

Code scanning / ESLint

Enforce consistent indentation Error

Expected indentation of 6 spaces but found 3 tabs.

Check failure

Code scanning / ESLint

Enforce Anthony's style of curly bracket Error

Expect curly brackets

Check failure

Code scanning / ESLint

Require or disallow semicolons instead of ASI Error

Extra semicolon.

if (media?.paused) {
delete presenceData.startTimestamp
Expand Down
Loading