[PR #3411] [MERGED] Add duration to local sessions on creation #3963

Closed
opened 2026-04-25 00:17:45 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/3411
Author: @justcallmelarry
Created: 9/12/2024
Status: Merged
Merged: 9/12/2024
Merged by: @advplyr

Base: masterHead: feature/add-duration-when-creating-sessions


📝 Commits (2)

  • 0c24a1e add duration to session when creating
  • d430d9f add new setDuration and use that

📊 Changes

2 files changed (+10 additions, -5 deletions)

View changed files

📝 server/managers/PlaybackSessionManager.js (+1 -0)
📝 server/objects/PlaybackSession.js (+9 -5)

📄 Description

If session is not sent in by the clients it defaults to 0. This uses libraryItem.duration when creating the session.

Duration seems like something that shouldn't have to be provided by the clients, and can safely be used from the data already present in the server. Additionally this is how it already works for the non-local sessions.

I could switch to only use it if either !session.duration or session.duration !== null, but I personally feel like there is no need to use anything other than libraryItem as the source of truth for this attribute in particular.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/3411 **Author:** [@justcallmelarry](https://github.com/justcallmelarry) **Created:** 9/12/2024 **Status:** ✅ Merged **Merged:** 9/12/2024 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `feature/add-duration-when-creating-sessions` --- ### 📝 Commits (2) - [`0c24a1e`](https://github.com/advplyr/audiobookshelf/commit/0c24a1e626f5b0ad83ebeb91d4b2c597185d60b1) add duration to session when creating - [`d430d9f`](https://github.com/advplyr/audiobookshelf/commit/d430d9f3ed6d7b3f662bea94d3b9738d3bcd5ddf) add new setDuration and use that ### 📊 Changes **2 files changed** (+10 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `server/managers/PlaybackSessionManager.js` (+1 -0) 📝 `server/objects/PlaybackSession.js` (+9 -5) </details> ### 📄 Description If session is not sent in by the clients it defaults to 0. This uses `libraryItem.duration` when creating the session. Duration seems like something that shouldn't have to be provided by the clients, and can safely be used from the data already present in the server. Additionally this is how it already works for the non-local sessions. I could switch to only use it if either `!session.duration` or `session.duration !== null`, but I personally feel like there is no need to use anything other than `libraryItem` as the source of truth for this attribute in particular. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:17:45 +02:00
adam closed this issue 2026-04-25 00:17:45 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#3963