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

Refactor media session to playback subscriber #6271

Merged
merged 2 commits into from
Jan 11, 2025

Conversation

thornbill
Copy link
Member

Changes

  • Migrates MediaSession handling to TypeScript and a PlaybackSubscriber
  • Removes duplicate functions for getting the "now playing" image

Issues
N/A

@thornbill thornbill added typescript PRs or issues relating to TypeScript code cleanup Cleanup of legacy code or code smells labels Oct 30, 2024
@thornbill thornbill added this to the v10.11.0 milestone Oct 30, 2024
Copy link

@jellyfin-bot
Copy link
Collaborator

jellyfin-bot commented Oct 30, 2024

Cloudflare Pages deployment

Latest commit 1cbb4d0
Status ✅ Deployed!
Preview URL https://b85be356.jellyfin-web.pages.dev
Type 🔀 Preview

View build logs

@thornbill thornbill marked this pull request as ready for review November 18, 2024 19:33
@thornbill thornbill requested a review from a team as a code owner November 18, 2024 19:33
const album = item.Album || undefined;
const names = nowplayinghelper.getNowPlayingNames(item);
const artist = names[names.length - 1].text;
const title = names.length === 1 ? undefined : names[0].text;
Copy link
Member

Choose a reason for hiding this comment

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

This condition is unnecessary? If you use nullish coalescing, text will be undefined if the index doesn't exist.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call... I tend to forget about using nullish coalescing when accessing by index. 😅

Copy link
Member

Choose a reason for hiding this comment

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

I also see that you guys don't have https://www.typescriptlang.org/tsconfig/#noUncheckedIndexedAccess enabled, which in these cases it's a life saver

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh nice! I will enable that in a separate PR because it introduced 70 errors. 🙃

Copy link
Member

Choose a reason for hiding this comment

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

Lucky you, I had a bunch of errors in Vue when I enabled it!


return ServerConnections.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
}
if (item.ParentThumbItemId && item.ParentThumbImageTag) {
Copy link
Member

Choose a reason for hiding this comment

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

Add blank link between these two if blocks. All other conditionals have a blank line between blocks.

Copy link

sonarqubecloud bot commented Jan 6, 2025

@thornbill thornbill merged commit 1362284 into jellyfin:master Jan 11, 2025
15 checks passed
@thornbill thornbill deleted the media-session-subscriber branch January 11, 2025 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Cleanup of legacy code or code smells typescript PRs or issues relating to TypeScript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants