feat(scan): probe & store total video/audio duration at scan time#307
Merged
Conversation
Probe each time-based file's total duration via ffprobe as it is indexed and store it under metadata_json['duration_seconds'] (the field the API already exposes as 'duration' and the player's scrubber reads). Previously duration was only probed lazily at transcode time, so the scrubber length grew as the stream/transcode manifest filled and seeking was unreliable. - MediaScanner: optional FfmpegRunner dep; probe video/movie/episode/audio on create; backfill missing duration for already-indexed items on re-scan. - Matches TranscodeManager::persistProbedDuration key/type/rounding so both paths agree; probe failures are caught and never abort a scan. - Wired FfmpegRunner into the MediaScanner autowire definition. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Comprehensibility | 4 minor |
| CodeStyle | 1 minor |
| Complexity | 3 medium |
🟢 Metrics 41 complexity · 0 duplication
Metric Results Complexity 41 Duplication 0
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #307 +/- ##
============================================
+ Coverage 58.87% 58.89% +0.02%
- Complexity 12524 12545 +21
============================================
Files 474 474
Lines 41195 41248 +53
============================================
+ Hits 24252 24295 +43
- Misses 16943 16953 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The web player's scrubber starts with a tiny total length that grows as the file streams, because duration was only probed lazily at transcode time. Seeking before the playhead reaches a point was unreliable. The user wants the full length known up front.
What
MediaScannernow probes each time-based file's total duration via the existingFfmpegRunner::probe()as it is indexed and stores it undermetadata_json['duration_seconds']— the fieldMediaItemShaperalready exposes to the API asdurationand the player reads.video/movie/episode/audio; neverimage/book/photo.TranscodeManager::persistProbedDuration()key/type/(int) round((float))rounding so the scan- and transcode-time paths agree.FfmpegRunnerinto theMediaScannerautowire definition.Tests
7 new
MediaScannerTestcases (mockedFfmpegRunner): new-video populated, audio probed, image/book never probed, null/throw does not abort, re-scan backfill, no re-probe when present. Full Unit/Media suite green (930 tests).Verify
phpcs PSR-12 clean · phpstan L9 [OK] · phpunit green.
🤖 Generated with Claude Code