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

Improved Metadata Handling and PlaybackSession Metadata Robustness #3690

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all 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
12 changes: 12 additions & 0 deletions server/managers/PlaybackSessionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,18 @@ class PlaybackSessionManager {
// New session from local
session = new PlaybackSession(sessionJson)
session.deviceInfo = deviceInfo
// This makes sure that the client's metadata is preferred over the library's metadata, if available, to make a non-breaking change
if(session.mediaMetadata == null) {
// Only sync important metadata
const { title, subtitle, narrators, authors, author, series, genres, type } = libraryItem?.media?.metadata || {}
session.mediaMetadata = { title, subtitle, narrators, authors, author, series, genres, type }
}
if(session.displayTitle == null || session.displayTitle === '') {
session.displayTitle = libraryItem?.media?.metadata?.title ?? ''
}
if(session.displayAuthor == null || session.displayAuthor === '') {
session.displayAuthor = libraryItem?.media?.metadata?.authors?.map(a => a.name).join(', ') ?? libraryItem?.media?.metadata?.author ?? ''
}
session.duration = libraryItem.media.getPlaybackDuration(sessionJson.episodeId)

Logger.debug(`[PlaybackSessionManager] Inserting new session for "${session.displayTitle}" (${session.id})`)
Expand Down
Loading