Skip to content

fix(android): keep addon IMDb rating over TMDB vote average#1310

Open
DynamycSound wants to merge 1 commit into
NuvioMedia:cmp-rewritefrom
DynamycSound:fix/imdb-rating-tmdb-overwrite
Open

fix(android): keep addon IMDb rating over TMDB vote average#1310
DynamycSound wants to merge 1 commit into
NuvioMedia:cmp-rewritefrom
DynamycSound:fix/imdb-rating-tmdb-overwrite

Conversation

@DynamycSound

Copy link
Copy Markdown
Contributor

Summary

The IMDb rating shown on the details screen was being replaced with TMDB's vote_average during metadata enrichment. The value rendered under the IMDb logo/label was therefore TMDB's rating, not the IMDb rating. This change keeps the addon-provided IMDb rating and only falls back to TMDB when the addon supplies none.

PR type

  • Reproducible bug fix
  • UI glitch/bug fix
  • Behavior bug/regression fix
  • Small maintenance only, with no UI or behavior change
  • Docs accuracy fix
  • Translation/localization only
  • Approved larger or directional change

Why

In TmdbMetadataService.applyEnrichment, the useBasicInfo branch assigned:

imdbRating = enrichment.rating?.formatRating() ?: updated.imdbRating

enrichment.rating is sourced from TMDB's details.voteAverage. Because TMDB's value took priority via ?:, whenever TMDB enrichment was enabled (the default when a TMDB API key is configured) the real IMDb rating parsed from the meta addon (e.g. Cinemeta's imdbRating) was overwritten with TMDB's vote_average. The details screen (DetailMetaInfo) renders meta.imdbRating under the IMDb logo and yellow IMDb styling, so users saw a TMDB rating mislabeled as IMDb.

Empirical check (TMDB v3 API vs Cinemeta) for The Dark Knight: Cinemeta imdbRating = 9.1, TMDB vote_average = 8.531 → formatted 8.5. The app displayed 8.5 under the IMDb label instead of 9.1. TMDB's vote_average diverges from the IMDb rating for the majority of titles, matching the report's "Often (more than 50%)".

Issue or approval

Fixes #1271

UI / behavior impact

  • No UI change
  • No behavior change
  • UI changed only to fix a documented glitch/bug
  • Behavior changed only to fix a documented bug/regression
  • UI change has explicit maintainer approval
  • Behavior change has explicit maintainer approval

Old behavior: IMDb-labeled rating showed TMDB's vote_average whenever TMDB enrichment was enabled.
Broken behavior: the displayed IMDb rating was wrong for most titles.
New behavior: the addon-provided IMDb rating is shown; TMDB's rating is used only as a fallback when the addon provides no IMDb rating (e.g. the standalone TMDB-only path is unchanged). No layout, color, or label changes.

Policy check

  • I have read and understood CONTRIBUTING.md.
  • This PR is small, focused, and limited to one problem.
  • This PR is not cosmetic-only.
  • Any UI change fixes a linked glitch/bug and includes visual proof, or this PR has no UI change.
  • Any behavior change fixes a linked bug/regression or has explicit approval, or this PR has no behavior change.
  • This PR does not bundle unrelated refactors, cleanups, formatting, or drive-by changes.
  • This PR does not add dependencies, architecture changes, migrations, or product-direction changes without explicit approval.
  • I listed the testing performed below.

Scope boundaries

  • composeApp/src/commonMain/kotlin/com/nuvio/app/features/tmdb/TmdbMetadataService.kt — in applyEnrichment, the useBasicInfo branch now prefers updated.imdbRating (addon value) and falls back to enrichment.rating?.formatRating() (TMDB value) instead of the reverse. One line changed.
  • composeApp/src/commonTest/kotlin/com/nuvio/app/features/tmdb/TmdbMetadataServiceTest.kt — two added unit tests.

No other files touched. No formatting/rename changes.

Testing

  • ./gradlew :composeApp:assembleFullDebug → BUILD SUCCESSFUL.
  • ./gradlew :composeApp:testFullDebugUnitTest --tests "com.nuvio.app.features.tmdb.TmdbMetadataServiceTest" → BUILD SUCCESSFUL (all pass), including the two new tests:
    • applyEnrichment keeps addon imdb rating instead of tmdb vote average — base imdbRating = "9.1", enrichment.rating = 8.531; asserts result is "9.1" (fails before this change, which produced "8.5").
    • applyEnrichment falls back to tmdb rating when addon has none — base imdbRating = null, enrichment.rating = 8.531; asserts result is "8.5" (fallback path preserved).
  • Full suite: 4 unrelated tests fail (LibraryRepositoryTest, StreamAutoPlaySelectorTest); these fail identically on a clean cmp-rewrite checkout without this change and are pre-existing.
  • Blast radius (applyEnrichment): used only by enrichMetaMetaDetailsRepository.tryFetchMeta. The standalone TMDB-only path (buildStandaloneMeta) is intentionally left unchanged, so titles without an addon meta are unaffected.

Screenshots / Video (UI changes only)

Not a UI change.

Breaking changes

None.

Linked issues

Fixes #1271

The IMDb-labeled rating on the details screen was being overwritten with
TMDB's vote_average during metadata enrichment, so the value shown under
the IMDb logo was actually TMDB's rating. Prefer the addon-provided IMDb
rating and only fall back to TMDB when the addon supplies none.
@harrydbarnes

Copy link
Copy Markdown

Nice work, thanks. Hope we can add this

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.

[Bug]: wrong IMDb ratings

2 participants