/
/
/
# What does this implement/fix? Resuming a multi-file audiobook part-way through would shrink the book's stored duration to just the part that was left to play. Progress reporting then used that shortened length, so a book could be marked as finished while there was still plenty left. When the audio source takes care of seeking itself, the seek position is passed on to that source and cleared. At the end of the stream the duration was recalculated as if playback had started at the very beginning, so only the remaining audio was counted. This also affects normal tracks from providers that seek themselves (Spotify, for example): seeking past the first minute of a track could get it marked as played, and scrobbled, well before it actually ended. Changes: - Remember the position that was originally asked for, and only store a newly measured duration when the item really did play from the start. - Added tests for both cases: a multi-file book, and a provider stream that handles its own seeking. Present in `stable` as well, so labelled for backport. ## Types of changes - [x] Bugfix (non-breaking change which fixes an issue) — `bugfix` - [ ] New feature (non-breaking change which adds functionality) — `new-feature` - [ ] Enhancement to an existing feature — `enhancement` - [ ] New music/player/metadata/plugin provider — `new-provider` - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) — `breaking-change` - [ ] Refactor (no behaviour change) — `refactor` - [ ] Documentation only — `documentation` - [ ] Maintenance / chore — `maintenance` - [ ] CI / workflow change — `ci` - [ ] Dependencies bump — `dependencies` ## Checklist - [x] The code change is tested and works locally. - [x] `pre-commit run --all-files` passes. - [x] `pytest` passes, and tests have been added/updated under `tests/` where applicable. - [ ] For changes to shared models, the companion PR in `music-assistant/models` is linked. - [ ] For changes affecting the UI, the companion PR in `music-assistant/frontend` is linked. - [x] I have read and complied with the project's [AI Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md) for any AI-assisted contributions. - [ ] I have [raised a PR against the documentation repository](https://github.com/music-assistant/music-assistant.io/blob/main/CONTRIBUTING.md) targeting the main or beta branch as appropriate.