From 20a1d40d990b1d14750ba061a0dd808a016cb0ec Mon Sep 17 00:00:00 2001 From: advplyr Date: Sun, 1 Oct 2023 12:44:52 -0500 Subject: [PATCH] Fix:Set date properly on local playback sessions #2168 --- server/controllers/LibraryItemController.js | 6 ------ server/objects/PlaybackSession.js | 8 +++++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/controllers/LibraryItemController.js b/server/controllers/LibraryItemController.js index 498398f7..4aff7a13 100644 --- a/server/controllers/LibraryItemController.js +++ b/server/controllers/LibraryItemController.js @@ -280,12 +280,6 @@ class LibraryItemController { return CacheManager.handleCoverCache(res, libraryItem.id, libraryItem.media.coverPath, options) } - // GET: api/items/:id/stream - openStream(req, res) { - // this.streamManager.openStreamApiRequest(res, req.user, req.libraryItem) - res.sendStatus(500) - } - // POST: api/items/:id/play startPlaybackSession(req, res) { if (!req.libraryItem.media.numTracks && req.libraryItem.mediaType !== 'video') { diff --git a/server/objects/PlaybackSession.js b/server/objects/PlaybackSession.js index 4fe3d8fd..20b50009 100644 --- a/server/objects/PlaybackSession.js +++ b/server/objects/PlaybackSession.js @@ -168,7 +168,13 @@ class PlaybackSession { this.currentTime = session.currentTime || 0 this.startedAt = session.startedAt - this.updatedAt = session.updatedAt || null + this.updatedAt = session.updatedAt || session.startedAt + + // Local playback sessions dont set this date field so set using updatedAt + if (!this.date && session.updatedAt) { + this.date = date.format(new Date(session.updatedAt), 'YYYY-MM-DD') + this.dayOfWeek = date.format(new Date(session.updatedAt), 'dddd') + } } get mediaItemId() {