Skip to content

feat(web): Media Info dialog + consolidated media-spec formatters - #323

Merged
Quick104 merged 3 commits into
mainfrom
claude/agitated-swirles-4519bb
Jul 7, 2026
Merged

Quick104 merged 3 commits into
mainfrom
claude/agitated-swirles-4519bb

Conversation

@Quick104

@Quick104 Quick104 commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

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:

  1. refactor(web): consolidate media-spec formatters into web/src/lib/mediaFormat.ts. One canonical implementation each for file size, bitrate, Mbps, sample rate, channels, codec labels (formatCodecLabel + fuzzy mapAudioLabel), 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; dead TrackSection/TrackRow removed; versionFormatUtils.tsx → .ts. The quality-menu Mbps label stays local in useTranscodeQuality as a distinct display policy (renamed formatQualityBitrate).

  2. 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; VersionVideoTrack in api/types.ts was missing the dv_profile/dv_bl_compat_id/dv_el_present/hdr10_plus/video_range_type fields 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 in mediaSpecSections.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.ts and VersionFlyout.test.ts are 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)").
  • Poster-badge helpers moved verbatim and gained unit tests.
  • Full web suite: 1196 passed; the only 4 failures (CompatibilityProxiesSettings, ServerStorageStep) fail identically on main (pre-existing jsdom environment issues).
  • tsc, ESLint (0 errors), prettier, and vite build all 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

  • Older probed files simply omit rows for fields that predate their scan (falsy fields are dropped, no blank placeholders).
  • Not extracted: MaxCLL/MaxFALL mastering metadata (needs scanner-side side-data parsing + re-probe) — possible follow-up.
  • VersionVideoTrack (api) vs PlayerVideoTrack (player) stay separate: player/types.ts is 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/v1 surface 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

  • New Features
    • Added a “Media Info” dialog for item versions, with an improved spec sheet view and an empty-state when no media is available.
    • Added “View media info” actions to media locations and a “Media Info” option in the item action menu (when metadata curation is available).
  • Bug Fixes
    • Improved consistency of displayed media details (size, bitrate, channels, resolution, and Dolby Vision/HDR10+ labeling).
    • Refined bitrate formatting in the transcode quality menu and improved handling of missing/empty metadata.

Quick104 and others added 2 commits July 6, 2026 20:21
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]>
@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 71179dd2-4f71-4c3a-937f-d0a555683510

📥 Commits

Reviewing files that changed from the base of the PR and between 5fcc20e and f31b8bc.

📒 Files selected for processing (2)
  • web/src/pages/ItemDetail/components/mediaSpecSections.test.ts
  • web/src/pages/ItemDetail/components/mediaSpecSections.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • web/src/pages/ItemDetail/components/mediaSpecSections.test.ts
  • web/src/pages/ItemDetail/components/mediaSpecSections.ts

📝 Walkthrough

Walkthrough

Adds 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.

Changes

Media formatting consolidation and Media Info feature

Layer / File(s) Summary
API type extensions and shared formatting
web/src/api/types.ts, web/src/lib/mediaFormat.ts, web/src/lib/mediaFormat.test.ts
VersionVideoTrack gains Dolby Vision/HDR10+/video_range_type fields, and shared helpers for codec, audio, file size, bitrate, sample rate, channels, Dolby Vision, resolution, and HDR formatting are added with tests.
Consumer rewiring to shared helpers
web/src/components/*, web/src/pages/ItemDetail/*, web/src/player/*, web/src/lib/overlays/registry/tech.ts, web/src/pages/adminActivityPresentation.ts
Consumers switch from local formatting helpers to @/lib/mediaFormat; ItemCard changes bitrate fallback handling; overlay tech helpers add HDR/audio/video icon mapping.
Media spec section builders
web/src/pages/ItemDetail/components/mediaSpecSections.ts, web/src/pages/ItemDetail/components/mediaSpecSections.test.ts
Adds media-spec formatting utilities and section builders for General, Video, Audio, and Subtitle sections with coverage for label formatting and section output.
MediaInfoDialog component
web/src/pages/ItemDetail/components/MediaInfoDialog.tsx
Adds a dialog that renders one spec sheet or an accordion of version spec sheets, plus an empty state when no versions exist.
Media Info actions and page wiring
web/src/components/MediaLocations.tsx, web/src/pages/ItemDetail/components/ActionBar.tsx, web/src/pages/ItemDetail/MovieContent.tsx, web/src/pages/ItemDetail/EpisodeContent.tsx
Adds onShowMediaInfo actions to the action bar and media locations, and wires dialog state/callbacks into movie and episode detail pages.

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)
Loading

Possibly related PRs

  • Silo-Server/silo-server#11: This PR’s new Media Info actions are gated by canCurateMetadata, which connects to the permission plumbing in the referenced PR.
  • Silo-Server/silo-server#26: ItemCard bitrate label changes here align with the sort_metrics/bitrate display work in the referenced PR.

Suggested labels: v1

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly captures the two main changes: the new Media Info dialog and the shared media-spec formatter consolidation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/agitated-swirles-4519bb

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +78 to +79
if (dolbyVision) {
return track.hdr10_plus ? `${dolbyVision} · HDR10+` : dolbyVision;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
web/src/pages/ItemDetail/components/mediaSpecSections.test.ts (1)

101-130: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add a case for hdr10_plus combined with a DOVI-combo video_range_type but no raw dolby_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 in mediaSpecSections.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

📥 Commits

Reviewing files that changed from the base of the PR and between bb8586d and 5fcc20e.

📒 Files selected for processing (27)
  • web/src/api/types.ts
  • web/src/components/DownloadVersionPicker.tsx
  • web/src/components/ItemCard.tsx
  • web/src/components/MangaFilesDialog.tsx
  • web/src/components/MediaLocations.tsx
  • web/src/lib/mediaFormat.test.ts
  • web/src/lib/mediaFormat.ts
  • web/src/lib/overlays/registry/tech.ts
  • web/src/pages/ItemDetail/EbookContent.tsx
  • web/src/pages/ItemDetail/EpisodeContent.tsx
  • web/src/pages/ItemDetail/MangaContent.tsx
  • web/src/pages/ItemDetail/MovieContent.tsx
  • web/src/pages/ItemDetail/components/ActionBar.tsx
  • web/src/pages/ItemDetail/components/AudioTracksPopover.tsx
  • web/src/pages/ItemDetail/components/MediaInfoDialog.tsx
  • web/src/pages/ItemDetail/components/VersionFlyout.tsx
  • web/src/pages/ItemDetail/components/mediaSpecSections.test.ts
  • web/src/pages/ItemDetail/components/mediaSpecSections.ts
  • web/src/pages/ItemDetail/components/prePlaySelection.ts
  • web/src/pages/ItemDetail/components/versionFormatUtils.test.ts
  • web/src/pages/ItemDetail/components/versionFormatUtils.ts
  • web/src/pages/ItemDetail/components/versionRankingUtils.test.ts
  • web/src/pages/ItemDetail/components/versionRankingUtils.ts
  • web/src/pages/adminActivityPresentation.ts
  • web/src/player/components/AudioTrackMenu.tsx
  • web/src/player/hooks/useTranscodeQuality.ts
  • web/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]>
@coderabbitai coderabbitai Bot added the v1.0 Silo v1 scope - auto-adds to the Silo v1 project label Jul 7, 2026
@Quick104
Quick104 merged commit d957edf into main Jul 7, 2026
7 checks passed
@Quick104
Quick104 deleted the claude/agitated-swirles-4519bb branch July 7, 2026 00:50
Quick104 added a commit that referenced this pull request Jul 10, 2026
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1.0 Silo v1 scope - auto-adds to the Silo v1 project

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant