Skip to content

Update totalBookDuration computation to account for metadata duration#331

Merged
neonsolstice merged 1 commit into
bookorbit:mainfrom
JamesMcNee:BO-330-fix-total-book-duration
Jun 14, 2026
Merged

Update totalBookDuration computation to account for metadata duration#331
neonsolstice merged 1 commit into
bookorbit:mainfrom
JamesMcNee:BO-330-fix-total-book-duration

Conversation

@JamesMcNee

@JamesMcNee JamesMcNee commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Update totalBookDuration computation to account for metadata duration when files lack duration data.

Previously the UI only looked at the total duration by summing all the file durations, however if the file duration is missing and there is one in audio metadata, this was never used.

It could be that there should always be a duration on the file and there is another bug somewhere with extraction of this value, if this is the case, happy to close this PR and investigate that, but would need steer from maintainers!

What does this PR do?

Closes #330

How did you test this?

Tested on a locally running dev server using the provided instructions in the original issue and can see the total duration post fix.

Screenshots

Anything non-obvious in the diff?

I did not add any tests as cannot see an existing test suite for this feature, if I have missed it though, please let me know.

Checklist

  • I've read through my own diff
  • This PR was discussed in an issue and has maintainer approval (for new features)
  • Lint and tests pass locally
  • No unintended files included (build artifacts, .env, personal configs)

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced audiobook progress and bookmark calculations to use metadata duration when file-based duration information is unavailable, ensuring more accurate progress tracking.

@github-actions github-actions Bot added the client Changes affecting the client application or frontend behavior. label Jun 14, 2026
@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d67cbb71-dd6b-4add-86ac-9f3480e3462c

📥 Commits

Reviewing files that changed from the base of the PR and between 8a159e8 and 5b0f5c2.

📒 Files selected for processing (1)
  • client/src/features/reader/audiobook/AudiobookReaderView.vue
🚧 Files skipped from review as they are similar to previous changes (1)
  • client/src/features/reader/audiobook/AudiobookReaderView.vue

📝 Walkthrough

Walkthrough

totalBookDuration in AudiobookReaderView.vue is updated to fall back to detail.audioMetadata.durationSeconds when the sum of loaded audio file durations equals 0, instead of returning 0 directly. This affects all downstream computed values that depend on total book duration.

Changes

Audiobook Duration Fallback

Layer / File(s) Summary
totalBookDuration fallback to metadata
client/src/features/reader/audiobook/AudiobookReaderView.vue
When the sum of loaded audio file durations is 0, totalBookDuration now returns detail.audioMetadata.durationSeconds instead of 0, fixing zero-duration display for audiobooks where file durations are not yet loaded.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 Hop, hop, the timer showed zero one day,
A duration lost somewhere along the way.
But metadata held the answer in store,
A fallback to rescue the clock evermore.
Now audiobooks tick with their rightful refrain! 🎧

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating totalBookDuration computation to use metadata duration as a fallback.
Description check ✅ Passed The PR description covers the motivation, testing approach, and includes a link to issue #330, though it doesn't check all checklist items (maintainer approval not confirmed).
Linked Issues check ✅ Passed The PR directly addresses issue #330 by implementing a fallback to metadata duration when file duration is missing, resolving the bug where duration showed as 0.
Out of Scope Changes check ✅ Passed The change is narrowly focused on the totalBookDuration computation logic and is directly related to issue #330, with no out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@JamesMcNee
JamesMcNee force-pushed the BO-330-fix-total-book-duration branch from 8a159e8 to 5b0f5c2 Compare June 14, 2026 07:47
@neonsolstice
neonsolstice merged commit cf0af2c into bookorbit:main Jun 14, 2026
2 checks passed
@JamesMcNee
JamesMcNee deleted the BO-330-fix-total-book-duration branch June 15, 2026 06:59
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.11.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions Bot added the released Issue or PR is included in a released version. label Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client Changes affecting the client application or frontend behavior. released Issue or PR is included in a released version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Audiobook duration shows 0 in the UI

2 participants