Skip to content

Fix intermittent episode artwork not updating on filters page#5303

Open
lromero16 wants to merge 1 commit into
mainfrom
fix/filters-episode-artwork-not-updating
Open

Fix intermittent episode artwork not updating on filters page#5303
lromero16 wants to merge 1 commit into
mainfrom
fix/filters-episode-artwork-not-updating

Conversation

@lromero16
Copy link
Copy Markdown
Collaborator

Description

Fixes #PCDROID-79

Root cause: PodcastEpisode.thumbnailStatus has three constants — THUMBNAIL_STATUS_UNKNOWN, THUMBNAIL_STATUS_EMBEDDED_AVAILABLE, and THUMBNAIL_STATUS_EMBEDDED_NOT_AVAILABLE — but PlaybackManager.onMetadataAvailable() never set it. When embedded artwork is extracted from a downloaded audio file during playback and saved to the artworkCacheFile on disk, the episode's DB record was never updated. Because Room didn't re-emit, DiffUtil detected no changes, and the filters page ViewHolder was never rebound to show the newly extracted artwork.

Fix: After saving chapters in onMetadataAvailable(), fetch the episode and set thumbnailStatus to the appropriate value (only once, when still THUMBNAIL_STATUS_UNKNOWN). This DB write triggers Room → DiffUtil → onBindViewHolderbindArtwork() → Coil loads from the local cache file.

Testing Instructions

  1. Find a podcast episode that has embedded artwork (common in many podcasts)
  2. Open the filters page — note the episode shows podcast-level CDN artwork
  3. Play the episode to completion or for a few seconds (allowing the player to read metadata)
  4. Return to the filters page — the episode should now show its embedded artwork without needing to scroll

Screenshots or Screencast

Checklist

  • If this is a user-facing change, I have added an entry in CHANGELOG.md
  • Ensure the linter passes (./gradlew spotlessApply to automatically apply formatting/linting)
  • I have considered whether it makes sense to add tests for my changes
  • All strings that need to be localized are in modules/services/localization/src/main/res/values/strings.xml
  • Any jetpack compose components I added or changed are covered by compose previews
  • I have updated (or requested that someone edit) the spreadsheet to reflect any new or changed analytics.

I have tested any UI changes...

  • with different themes
  • with a landscape orientation
  • with the device set to have a large display and font size
  • for accessibility with TalkBack

…back

When an episode with embedded artwork is played for the first time,
EpisodeFileMetadata extracts and saves the artwork to disk. However,
thumbnailStatus on the episode was never updated, so Room never
re-emitted, DiffUtil detected no changes, and the filters page
ViewHolder was never rebound to show the embedded artwork.

Set thumbnailStatus to THUMBNAIL_STATUS_EMBEDDED_AVAILABLE or
THUMBNAIL_STATUS_EMBEDDED_NOT_AVAILABLE (once, when still UNKNOWN)
so that the database change propagates to the UI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lromero16 lromero16 requested a review from a team as a code owner May 13, 2026 20:22
@lromero16 lromero16 requested review from geekygecko and removed request for a team May 13, 2026 20:22
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@dangermattic
Copy link
Copy Markdown
Collaborator

1 Error
🚫 PR requires a [Type] label and either a [Area] or [Project] label.
1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

Copy link
Copy Markdown
Member

@geekygecko geekygecko left a comment

Choose a reason for hiding this comment

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

Can you please follow the checklist in the PR description template, include screenshots or video, and sign the CLA.

@geekygecko
Copy link
Copy Markdown
Member

@copilot review this

Copy link
Copy Markdown
Contributor

Copilot AI commented May 14, 2026

@copilot review this

Code review findings for the PR:

Bug found: The original onMetadataAvailable() change incorrectly sets THUMBNAIL_STATUS_EMBEDDED_NOT_AVAILABLE when useEpisodeArtwork=false. In that case, EpisodeFileMetadata.read() skips artwork extraction entirely — embeddedArtworkPath is always null — but the code was treating that as "no embedded artwork". If the user later enables the setting, the episode's thumbnailStatus is no longer UNKNOWN, so it would never be re-evaluated and the artwork would never appear.

Fix prepared (commit e76f3a8, pending push):

  • Extracted into internal fun resolveThumbnailStatus(embeddedArtworkPath, useEpisodeArtwork): Int? — returns null when useEpisodeArtwork=false (extraction not attempted), so the status stays UNKNOWN for future evaluation; returns THUMBNAIL_STATUS_EMBEDDED_AVAILABLE when artwork was extracted; returns THUMBNAIL_STATUS_EMBEDDED_NOT_AVAILABLE only when extraction was attempted but no artwork was found.
  • Added ResolveThumbnailStatusTest covering all three cases.

Note: The push is currently blocked by the danger/pr-check required status check, which is failing due to missing PR [Type] and [Area]/[Project] labels (see Danger bot comment). Once labels are added, the check will pass and the fix commit can be pushed.

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.

5 participants