feat: on-demand subtitle tracks for direct-play clients#306
Merged
Conversation
A direct-play client streams the original container and so has no HLS .vtt
sidecar to read. Adds two endpoints that expose embedded TEXT subtitle tracks:
GET /api/v1/media/{id}/subtitles list text tracks (ffprobe)
GET /api/v1/media/{id}/subtitles/{index} that track extracted as WebVTT
The list reuses SubtitleExtractor::detectTextTracks (bitmap PGS/VobSub excluded);
the fetch adds FfmpegRunner::extractSubtitleVtt (ffmpeg -map 0:s:N -c:s webvtt)
then strips ASS markup via AssWebVttCleaner, through a temp file that is always
removed. Verified end-to-end against real ffmpeg (subrip mkv -> WebVTT).
Co-Authored-By: Claude Opus 4.8 <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 |
|---|---|
| UnusedCode | 3 medium |
| BestPractice | 1 medium |
| Documentation | 17 minor |
| ErrorProne | 8 medium |
| Security | 10 high |
| CodeStyle | 28 minor |
| Complexity | 1 medium |
| Comprehensibility | 1 minor |
🟢 Metrics 53 complexity · 0 duplication
Metric Results Complexity 53 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 #306 +/- ##
============================================
+ Coverage 58.79% 58.81% +0.02%
- Complexity 12454 12476 +22
============================================
Files 472 473 +1
Lines 41001 41050 +49
============================================
+ Hits 24106 24145 +39
- Misses 16895 16905 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Review follow-up: subtitle cue text is real dialogue from inside the file, so the two routes move into the existing auth-gated marker/extras group instead of being world-readable. Also extracts a configString() helper and wraps the group call to satisfy the PSR-12 120-char limit (the Component-Tests code-style gate). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Phase 4 (phlix-console-client) — subtitle overlay, server side
A direct-play client streams the original container, so it has no HLS
.vttsidecar to read. These two endpoints expose an item's embedded text subtitle tracks on demand:/api/v1/media/{id}/subtitles{tracks: [{index, language, label, default, codec, filename}]}/api/v1/media/{id}/subtitles/{index}text/vttImplementation (reuses the existing
Subtitlestoolkit)SubtitleController—listTracksrunsFfmpegRunner::probe→SubtitleExtractor::detectTextTracks(bitmap PGS/VobSub excluded — no text);getTrackextracts one track and returns the cleaned WebVTT.FfmpegRunner::extractSubtitleVtt—ffmpeg -map 0:s:{index} -c:s webvtt -f webvtt(transcodes ASS/SRT/mov_text → WebVTT), via a temp file that is always removed; the markup is then stripped with the existingAssWebVttCleaner.Application.phpnext toplayback-info.Verification
subripmkv →detectTextTracks(1 track) →extractSubtitleVtt→ valid WebVTT.ItemRepository/FfmpegRunner, realSubtitleExtractor): list 404 / tracks (bitmap excluded) / empty-when-missing-file; get-track WebVTT +Content-Type, 404 on not-found / extraction-fail / non-numeric index. Full controllers suite 429 green.phpcsPSR-12 clean;phpstan --level=9clean on the changed files.🤖 Generated with Claude Code