Skip to content

feat: add IMAX badge and fix DV false-positive detection (#118) - #128

Merged
ProdigyV21 merged 1 commit into
mainfrom
feat/stream-badges-imax-dv
Apr 5, 2026
Merged

feat: add IMAX badge and fix DV false-positive detection (#118)#128
ProdigyV21 merged 1 commit into
mainfrom
feat/stream-badges-imax-dv

Conversation

@ProdigyV21

Copy link
Copy Markdown
Owner

Summary

Closes #118.

Adds an IMAX badge to stream source entries and fixes a long-standing false-positive where SD DVDrip sources were being incorrectly flagged as Dolby Vision.

Root cause

Two bugs in CompactQualityBadge in StreamSelector.kt:1010-1083:

  1. DV false positives — The DV badge used:

    val isDV = quality.contains("DV", ignoreCase = true) || quality.contains("Dolby Vision", ignoreCase = true)

    Substring matching on "DV" matched everything containing those two letters, including "DVD", "HDVD", "DVDRip", "MediaDVx", etc. Standard-definition DVD rips were visually indistinguishable from true Dolby Vision sources in the picker.

  2. No IMAX detection — IMAX was not in the badge list at all, despite being one of the most visually distinctive premium formats users explicitly scan for.

  3. Narrow search scope — Both HDR and DV detection only looked at the pre-extracted stream.quality string. IMAX and DV tokens almost always live in the filename / source title (stream.source or stream.behaviorHints.filename), not the quality ladder slot.

Fix

1. Widen the search blob

CompactQualityBadge now takes the full StreamSource instead of just quality, and builds a single search blob:

val searchBlob = buildString {
    append(stream.quality)
    append(' ')
    append(stream.source)
    append(' ')
    append(stream.behaviorHints?.filename.orEmpty())
}

This way tokens are detected wherever they appear.

2. Word-boundary regex constants

Replaced contains(...) substring matching with pre-compiled \b-bounded regexes:

private val DV_REGEX = Regex("""\b(DV|DoVi|Dolby[\s._-]*Vision)\b""", RegexOption.IGNORE_CASE)
private val HDR_REGEX = Regex("""\bHDR(10\+?|10)?\b""", RegexOption.IGNORE_CASE)
private val IMAX_REGEX = Regex("""\bIMAX\b""", RegexOption.IGNORE_CASE)
  • \bDV\b matches DV as a whole token but NOT DVD, HDVD, DVDRip.
  • DoVi and Dolby.Vision / Dolby_Vision / Dolby-Vision / Dolby Vision still match.
  • HDR regex also cleanly matches HDR10 and HDR10+ as the same badge.
  • IMAX regex matches the standalone IMAX token.

Regexes are declared at file scope with val, so they're compiled once.

3. IMAX badge

Rendered in a distinctive cyan/blue (0xFF06B6D4) so it stands out from HDR (purple) and DV (pink). Only rendered when isIMAX is true, so non-IMAX sources get no extra space.

Test cases handled

Source title Before After
Movie.2021.1080p.DVDRip.x264.mkv ❌ shows DV badge ✓ no DV badge
Movie.2021.2160p.IMAX.WEB-DL.DV.HDR.mkv only HDR shown 4K + HDR + DV + IMAX
Movie.2021.DoVi.Remux.mkv ❌ no DV badge (DoVi not in regex) ✓ DV badge
Movie.2021.Dolby.Vision.mkv ✓ (but for the wrong reason — substring match) ✓ (word-boundary match)
Movie.2021.HDR10+.mkv ✓ HDR badge ✓ HDR badge

Risk

Minimal. Single-file, 45-line change. Pure UI — no stream selection logic touched, no network calls, no settings, no cross-device state. The only API change is the internal helper signature (StringStreamSource), and there's only one call site which is updated in the same PR.

The stream source badges in the stream picker had two issues:

1. The DV (Dolby Vision) badge used `quality.contains("DV", ignoreCase = true)`
   which matched any string containing "DV" as a substring — including
   "DVD", "HDVD", "DVDRip", etc. Standard-definition DVD rips were being
   incorrectly flagged as Dolby Vision.

2. There was no IMAX badge at all. IMAX is one of the most visually
   distinctive premium formats and users scan source lists for it, but
   the badge row showed only HDR and DV.

A secondary issue: both HDR and DV detection only looked at the
pre-extracted `stream.quality` string, which rarely contains IMAX or
DV tokens. Those tokens almost always live in the filename / source
title (`stream.source` or `stream.behaviorHints.filename`).

Changes:
- `CompactQualityBadge` now takes the full `StreamSource` instead of
  just `quality`, and combines `quality + source + behaviorHints.filename`
  into a single search blob for token detection.
- Introduced pre-compiled `DV_REGEX`, `HDR_REGEX`, and `IMAX_REGEX`
  constants using `\b` word boundaries so "DV" no longer matches "DVD",
  "DoVi" and "Dolby Vision" still match, and "HDR10" / "HDR10+" match
  their own badge.
- Added an IMAX badge in a distinctive cyan/blue color (0xFF06B6D4) to
  stand out from HDR (purple) and DV (pink).

No change to the call site beyond passing `stream` instead of
`stream.quality`.

Closes #118
@ProdigyV21
ProdigyV21 merged commit 7d35574 into main Apr 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Source badges UI - Add IMAX & DV labels to stream entries

1 participant