Compare commits

...

9 commits

Author SHA1 Message Date
advplyr
04fb8fa61d
Merge pull request #3690 from Vito0912/feat/metadataForPlaybackSessions
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Build and Push Docker Image / build (push) Has been cancelled
Integration Test / build and test (push) Has been cancelled
Run Unit Tests / Run Unit Tests (push) Has been cancelled
Improved Metadata Handling and PlaybackSession Metadata Robustness
2025-04-18 17:08:12 -05:00
advplyr
2caa861b8a Update local session mediaMetadata with current item mediaMetadata for undefined values 2025-04-18 17:04:11 -05:00
advplyr
d7f0815fb3 Merge branch 'master' into feat/metadataForPlaybackSessions 2025-04-18 16:34:13 -05:00
Vito0912
e6ab05e177
update so also populates data if mediaMetadata is not null 2025-04-18 07:29:34 +02:00
Vito0912
121805ba39
Merge branch 'master' into feat/metadataForPlaybackSessions 2025-01-07 17:01:01 +01:00
Vito0912
f9bbd71174
added type to be saved. Should support podcasts
It should support everything important from the podcast metadata:
https://api.audiobookshelf.org/#podcast-metadata

And the book metadata:
https://api.audiobookshelf.org/#book-metadata
2024-12-17 15:27:37 +01:00
Vito0912
2fbb31e0ea
added null saftey and added displayTitle and displayAuthor 2024-12-07 10:37:00 +01:00
Vito0912
89167543fa
added author for podcasts 2024-12-07 10:25:52 +01:00
Vito0912
33e0987d73
Added mediaMetadata to playbackSessions 2024-12-07 10:09:14 +01:00

View file

@ -175,6 +175,25 @@ class PlaybackSessionManager {
// New session from local
session = new PlaybackSession(sessionJson)
session.deviceInfo = deviceInfo
if (session.mediaMetadata == null) {
session.mediaMetadata = {}
}
// Populate mediaMetadata with the current library items metadata for any keys not set by client
const libraryItemMediaMetadata = libraryItem.media.oldMetadataToJSON()
for (const key in libraryItemMediaMetadata) {
if (session.mediaMetadata[key] === undefined) {
session.mediaMetadata[key] = libraryItemMediaMetadata[key]
}
}
if (session.displayTitle == null || session.displayTitle === '') {
session.displayTitle = libraryItem.title
}
if (session.displayAuthor == null || session.displayAuthor === '') {
session.displayAuthor = libraryItem.authorNamesFirstLast
}
session.duration = libraryItem.media.getPlaybackDuration(sessionJson.episodeId)
Logger.debug(`[PlaybackSessionManager] Inserting new session for "${session.displayTitle}" (${session.id})`)