feat: add IMAX badge and fix DV false-positive detection (#118) - #128
Merged
Conversation
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
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.
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
CompactQualityBadgeinStreamSelector.kt:1010-1083:DV false positives — The DV badge used:
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.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.
Narrow search scope — Both HDR and DV detection only looked at the pre-extracted
stream.qualitystring. IMAX and DV tokens almost always live in the filename / source title (stream.sourceorstream.behaviorHints.filename), not the quality ladder slot.Fix
1. Widen the search blob
CompactQualityBadgenow takes the fullStreamSourceinstead of justquality, and builds a single search blob:This way tokens are detected wherever they appear.
2. Word-boundary regex constants
Replaced
contains(...)substring matching with pre-compiled\b-bounded regexes:\bDV\bmatchesDVas a whole token but NOTDVD,HDVD,DVDRip.DoViandDolby.Vision/Dolby_Vision/Dolby-Vision/Dolby Visionstill match.HDR10andHDR10+as the same badge.IMAXtoken.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 whenisIMAXis true, so non-IMAX sources get no extra space.Test cases handled
Movie.2021.1080p.DVDRip.x264.mkvMovie.2021.2160p.IMAX.WEB-DL.DV.HDR.mkvMovie.2021.DoVi.Remux.mkvMovie.2021.Dolby.Vision.mkvMovie.2021.HDR10+.mkvRisk
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 (
String→StreamSource), and there's only one call site which is updated in the same PR.