Improved Metadata Handling and PlaybackSession Metadata Robustness #3690
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Brief summary
This appends the server's existing
mediaMetadata
to theplaybackSession
if the client does not supply it.Which issue is fixed?
This resolves server crashes caused by missing
mediaMetadata
(even though they are addressed separately) and corrects inaccurate stats when the client does not providemediaMetadata
. Additionally, it slightly reduces bandwidth usage during local session syncing.In-depth Description
If
mediaMetadata
is absent in the payload sent by the client, the server will use the metadata it already has (libraryitem.media.metadata
).Only essential attributes are included in the
playbackSession
to avoid unnecessary data, such as descriptions, which are often lengthy and typically unneeded.Additionally,
displayTitle
anddisplayAuthor
will fall back to the correspondingmediaMetadata
values when not provided, ensuring they are displayed even if the client does not sends them.How have you tested this?
This has been tested with both my own client and the web client.
Copilot summary
This pull request includes changes to the
PlaybackSessionManager
class to ensure that client-provided metadata is preferred over library metadata when available. This change aims to make the system more robust and user-friendly by prioritizing user-specific information.Improvements to metadata handling:
server/managers/PlaybackSessionManager.js
: Added logic to prefer client-provided metadata (such as title, subtitle, narrators, authors, series, genres, and author) over library metadata if available. This ensures that important metadata is synchronized and displayed correctly.