Repository navigation
feat(web): Media Info dialog + consolidated media-spec formatters - #323
Conversation
Media-spec formatting was duplicated with divergent behavior across six
modules: versionFormatUtils (GB/"" fallback), playback-info (GiB/"—"
fallback, CODEC_LABELS), overlay tech.ts (prettyResolution,
compactHdrSuffix), versionRankingUtils (mapAudioLabel), plus private
formatBitrate copies in ItemCard and useTranscodeQuality.
One canonical module now owns these helpers; the deliberate per-surface
display differences (fallback text, GB vs GiB labels) are parameters
instead of copies. All call sites migrated, including two cross-boundary
imports (adminActivityPresentation reaching into @/player/playback-info,
player components reaching into page-level utils). The quality-menu Mbps
label in useTranscodeQuality stays local as a distinct display policy,
renamed formatQualityBitrate. Also removes the unused TrackSection/
TrackRow components and renames versionFormatUtils.tsx to .ts.
Behavior-preserving: playback-info.test.ts and VersionFlyout.test.ts are
unmodified and assert exact rendered strings ("7.1 GiB", "640 kbps",
"Dolby Vision Profile 8.1 (HDR10)").
Co-Authored-By: Claude Fable 5 <[email protected]>
Adds a curator/admin-gated "Media Info" dialog to movie and episode detail pages showing full technical specs per file: per-stream bitrates, Dolby Vision profile with base-layer compatibility and EL flags, HDR10+, chroma subsampling derived from pixel format, color primaries/transfer/ space, bit depth, codec profile/level (H.264, HEVC, and AV1 level decoding), audio layouts/sample rates, and subtitle stream details. Frontend-only: the item-detail response already serialized all of this; VersionVideoTrack in api/types.ts was just missing the DV/HDR10+/ video_range_type fields the backend sends. Entry points: a "Media Info" item in the detail-page overflow menu (opens on the selected version) and a per-row info button in Media locations (opens on that file). All versions render as accordion sections with the target expanded. Spec rows are built by pure section builders in mediaSpecSections.ts with fixture tests covering SDR/HDR10/DV 7/DV 8.1/HDR10+/multi-track/ external-subtitle cases; the dialog is a thin renderer over them. Co-Authored-By: Claude Fable 5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds shared media-format helpers, extends video metadata types, introduces media-spec section builders and a Media Info dialog, and wires new media-info actions into item detail pages and media locations. ChangesMedia formatting consolidation and Media Info feature
Estimated code review effort: 3 (Moderate) | ~35 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant ActionBar
participant MovieContent
participant EpisodeContent
participant MediaLocations
participant MediaInfoDialog
User->>ActionBar: select Media Info
ActionBar->>MovieContent: onShowMediaInfo()
ActionBar->>EpisodeContent: onShowMediaInfo()
MovieContent->>MediaInfoDialog: open with initialFileId
EpisodeContent->>MediaInfoDialog: open with initialFileId
MediaLocations->>MovieContent: onShowMediaInfo(fileId)
MediaLocations->>EpisodeContent: onShowMediaInfo(fileId)
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5fcc20e8ea
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (dolbyVision) { | ||
| return track.hdr10_plus ? `${dolbyVision} · HDR10+` : dolbyVision; |
There was a problem hiding this comment.
Preserve DV compatibility fallback from video_range_type
For profile-8 Dolby Vision files where ffprobe omits dv_bl_signal_compatibility_id, the scanner still derives video_range_type from color_transfer in internal/scanner/probe.go (e.g. DOVIWithHDR10 or DOVIWithHLG). This early return ignores that enum whenever dolby_vision is present, so the new Media Info dialog drops the HDR10/HLG/SDR compatibility detail and shows only Dolby Vision Profile 8 for those files.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f31b8bc: formatDolbyVisionLabel now falls back to the video_range_type enum (DOVIWithHDR10/HLG/SDR/WithEL) for the compatibility detail when the explicit DV side-data fields are absent, so profile-8 files without dv_bl_signal_compatibility_id show "Dolby Vision Profile 8 (HDR10 compatible)". Explicit side-data fields still take precedence. Covered by new unit tests.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
web/src/pages/ItemDetail/components/mediaSpecSections.test.ts (1)
101-130: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd a case for
hdr10_pluscombined with a DOVI-combovideo_range_typebut no rawdolby_vision/dv_profile.None of the current cases exercise
formatVideoRangeLabel({ video_range_type: "DOVIWithHDR10Plus", hdr10_plus: true })(dolby_vision/dv_profile absent). This is the scenario affected by the precedence issue flagged inmediaSpecSections.ts(Lines 76-87) — adding it here would lock in the fix and prevent regressions.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/src/pages/ItemDetail/components/mediaSpecSections.test.ts` around lines 101 - 130, Add a test in formatVideoRangeLabel to cover the DOVI-plus-HDR10+ combination when only video_range_type is present, specifically the case with video_range_type set to DOVIWithHDR10Plus and hdr10_plus true but without dolby_vision or dv_profile. Place it alongside the existing formatVideoRangeLabel cases in mediaSpecSections.test.ts and assert the expected combined label so the precedence behavior in formatVideoRangeLabel stays fixed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/src/pages/ItemDetail/components/mediaSpecSections.ts`:
- Around line 76-87: The `formatVideoRangeLabel` helper is checking the plain
`hdr10_plus` shortcut too early, which prevents richer Dolby Vision combinations
from being labeled correctly. Reorder the logic so the Dolby Vision path via
`formatDolbyVisionLabel(track)` and the `VIDEO_RANGE_TYPE_LABELS` lookup run
before the standalone `"HDR10+"` fallback, and keep `"HDR10+"` only as the last
resort when no `video_range_type` mapping applies.
---
Nitpick comments:
In `@web/src/pages/ItemDetail/components/mediaSpecSections.test.ts`:
- Around line 101-130: Add a test in formatVideoRangeLabel to cover the
DOVI-plus-HDR10+ combination when only video_range_type is present, specifically
the case with video_range_type set to DOVIWithHDR10Plus and hdr10_plus true but
without dolby_vision or dv_profile. Place it alongside the existing
formatVideoRangeLabel cases in mediaSpecSections.test.ts and assert the expected
combined label so the precedence behavior in formatVideoRangeLabel stays fixed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 84525f16-c793-42c8-ba2d-c5ed7ffdf51c
📒 Files selected for processing (27)
web/src/api/types.tsweb/src/components/DownloadVersionPicker.tsxweb/src/components/ItemCard.tsxweb/src/components/MangaFilesDialog.tsxweb/src/components/MediaLocations.tsxweb/src/lib/mediaFormat.test.tsweb/src/lib/mediaFormat.tsweb/src/lib/overlays/registry/tech.tsweb/src/pages/ItemDetail/EbookContent.tsxweb/src/pages/ItemDetail/EpisodeContent.tsxweb/src/pages/ItemDetail/MangaContent.tsxweb/src/pages/ItemDetail/MovieContent.tsxweb/src/pages/ItemDetail/components/ActionBar.tsxweb/src/pages/ItemDetail/components/AudioTracksPopover.tsxweb/src/pages/ItemDetail/components/MediaInfoDialog.tsxweb/src/pages/ItemDetail/components/VersionFlyout.tsxweb/src/pages/ItemDetail/components/mediaSpecSections.test.tsweb/src/pages/ItemDetail/components/mediaSpecSections.tsweb/src/pages/ItemDetail/components/prePlaySelection.tsweb/src/pages/ItemDetail/components/versionFormatUtils.test.tsweb/src/pages/ItemDetail/components/versionFormatUtils.tsweb/src/pages/ItemDetail/components/versionRankingUtils.test.tsweb/src/pages/ItemDetail/components/versionRankingUtils.tsweb/src/pages/adminActivityPresentation.tsweb/src/player/components/AudioTrackMenu.tsxweb/src/player/hooks/useTranscodeQuality.tsweb/src/player/playback-info.ts
💤 Files with no reviewable changes (1)
- web/src/pages/ItemDetail/components/versionRankingUtils.test.ts
Review follow-ups on the Media Info dialog's dynamic-range labels: - When ffprobe omits dv_bl_signal_compatibility_id, the scanner still derives video_range_type (DOVIWithHDR10/HLG/SDR) from color_transfer. formatDolbyVisionLabel now falls back to that enum for the compatibility detail instead of showing a bare "Dolby Vision Profile 8"; explicit DV side-data fields still win when present. - formatVideoRangeLabel checks the video_range_type mapping before the standalone HDR10+ shortcut, so DOVIWithHDR10Plus tracks without a raw dolby_vision string keep their Dolby Vision hint. Co-Authored-By: Claude Fable 5 <[email protected]>
* refactor(web): consolidate media-spec formatters into lib/mediaFormat
Media-spec formatting was duplicated with divergent behavior across six
modules: versionFormatUtils (GB/"" fallback), playback-info (GiB/"—"
fallback, CODEC_LABELS), overlay tech.ts (prettyResolution,
compactHdrSuffix), versionRankingUtils (mapAudioLabel), plus private
formatBitrate copies in ItemCard and useTranscodeQuality.
One canonical module now owns these helpers; the deliberate per-surface
display differences (fallback text, GB vs GiB labels) are parameters
instead of copies. All call sites migrated, including two cross-boundary
imports (adminActivityPresentation reaching into @/player/playback-info,
player components reaching into page-level utils). The quality-menu Mbps
label in useTranscodeQuality stays local as a distinct display policy,
renamed formatQualityBitrate. Also removes the unused TrackSection/
TrackRow components and renames versionFormatUtils.tsx to .ts.
Behavior-preserving: playback-info.test.ts and VersionFlyout.test.ts are
unmodified and assert exact rendered strings ("7.1 GiB", "640 kbps",
"Dolby Vision Profile 8.1 (HDR10)").
Co-Authored-By: Claude Fable 5 <[email protected]>
* feat(web): add Media Info dialog with detailed per-file technical specs
Adds a curator/admin-gated "Media Info" dialog to movie and episode
detail pages showing full technical specs per file: per-stream bitrates,
Dolby Vision profile with base-layer compatibility and EL flags, HDR10+,
chroma subsampling derived from pixel format, color primaries/transfer/
space, bit depth, codec profile/level (H.264, HEVC, and AV1 level
decoding), audio layouts/sample rates, and subtitle stream details.
Frontend-only: the item-detail response already serialized all of this;
VersionVideoTrack in api/types.ts was just missing the DV/HDR10+/
video_range_type fields the backend sends. Entry points: a "Media Info"
item in the detail-page overflow menu (opens on the selected version)
and a per-row info button in Media locations (opens on that file). All
versions render as accordion sections with the target expanded.
Spec rows are built by pure section builders in mediaSpecSections.ts
with fixture tests covering SDR/HDR10/DV 7/DV 8.1/HDR10+/multi-track/
external-subtitle cases; the dialog is a thin renderer over them.
Co-Authored-By: Claude Fable 5 <[email protected]>
* fix(web): recover DV compatibility detail from video_range_type
Review follow-ups on the Media Info dialog's dynamic-range labels:
- When ffprobe omits dv_bl_signal_compatibility_id, the scanner still
derives video_range_type (DOVIWithHDR10/HLG/SDR) from color_transfer.
formatDolbyVisionLabel now falls back to that enum for the
compatibility detail instead of showing a bare "Dolby Vision
Profile 8"; explicit DV side-data fields still win when present.
- formatVideoRangeLabel checks the video_range_type mapping before the
standalone HDR10+ shortcut, so DOVIWithHDR10Plus tracks without a raw
dolby_vision string keep their Dolby Vision hint.
Co-Authored-By: Claude Fable 5 <[email protected]>
---------
Co-authored-by: Claude Fable 5 <[email protected]>
Problem
There is no way to view a file's detailed technical specs (exact bitrate, Dolby Vision profile/tier, chroma subsampling, exact audio codecs) in the UI. The Media locations section shows paths and basic badges only. Separately, media-spec formatting logic had drifted into six divergent copies across the frontend (GB vs GiB labels,
""vs"—"fallbacks, three codec-label mappers), including cross-boundary imports of player internals from pages.Approach
Two commits, refactor first so the feature builds on it:
refactor(web): consolidate media-spec formatters intoweb/src/lib/mediaFormat.ts. One canonical implementation each for file size, bitrate, Mbps, sample rate, channels, codec labels (formatCodecLabel+ fuzzymapAudioLabel), Dolby Vision prefixing, and the overlay badge helpers (prettyResolution,compactHdrSuffix). Deliberate per-surface display differences are parameters (fallback text, GB vs GiB) instead of copies. All call sites migrated; deadTrackSection/TrackRowremoved;versionFormatUtils.tsx→.ts. The quality-menu Mbps label stays local inuseTranscodeQualityas a distinct display policy (renamedformatQualityBitrate).feat(web): Media Info dialog for movies/episodes (curator/admin-gated, like the Media locations section). Frontend-only — the item-detail response already carried full per-track data;VersionVideoTrackinapi/types.tswas missing thedv_profile/dv_bl_compat_id/dv_el_present/hdr10_plus/video_range_typefields the backend already sends. Entry points: overflow-menu item (opens on the selected version) and a per-row info button in Media locations (opens on that file). All versions render as accordion sections, target expanded. Spec rows come from pure builders inmediaSpecSections.ts(chroma subsampling from pixel format, DV profile/BL-compat/EL composition, codec-aware H.264/HEVC/AV1 level decoding), fixture-tested across SDR/HDR10/DV7/DV8.1+HDR10+/multi-track/external-subtitle cases.Behavior preservation (refactor)
playback-info.test.tsandVersionFlyout.test.tsare unmodified and pass — they assert the exact rendered strings of the player stats overlay ("7.1 GiB", "22.5 Mbps", "640 kbps", "48,000 Hz", "Dolby Vision Profile 8.1 (HDR10)", "H.264 (copy)").CompatibilityProxiesSettings,ServerStorageStep) fail identically on main (pre-existing jsdom environment issues).tsc, ESLint (0 errors), prettier, andvite buildall pass; each commit builds and tests standalone.Screenshots
Not included: the modal and player overlay live behind authentication on the dev deployment and this branch was verified headlessly (unit tests pin the exact rendered strings). Happy to add screenshots from a signed-in session before merge if wanted.
Risks / follow-ups
VersionVideoTrack(api) vsPlayerVideoTrack(player) stay separate:player/types.tsis deliberately self-contained and the player doesn't consume the new DV fields; merging would couple the player to API types for no functional gain.Scope link
No linked issue — this started as a quality-of-life feature request (Plex-style "Media Info") plus the maintainability cleanup it surfaced, per the repo's duplicate-logic guideline. Additive UI only; no
/api/v1surface changes.AI-use disclosure
Implemented by Claude Code (Claude Fable 5) under human direction; design decisions (data scope, gating, entry points, commit split) were human-approved.
🤖 Generated with Claude Code
Summary by CodeRabbit