improve: Unlocalised Video Titles#5793
Open
bluegate-studio wants to merge 2 commits into
Open
Conversation
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.
Problem
The "Unlocalised video titles" feature fires a separate HTTP request (to YouTube's oEmbed endpoint) for every video card on screen. A typical Home screen with ~50 videos triggers ~50 individual network requests — on every visit, with no caching across sessions.
Additionally, the player title bar was not covered by the feature. Videos entering the player via deep links, casting, or remote control would display YouTube's auto-translated
metadataTitleinstead of the original.Changes
1. Persistent title cache (
UnlocalizedTitleData)UnlocalizedTitleData— SharedPreferences-backed FIFO cache (5,000 entries) mappingvideoId → original title.Helpers.mergeMap/parseMapfor serialisation,Utils.postDelayed(10s debounce) for disk writes.2. Cache-first processor (
UnlocalizedTitleProcessor)VideoGroup, the processor now checks the cache before queueing an oEmbed request.3. Player title coverage (
SuggestionsController)video.sync(metadata)sets the (potentially translated)metadataTitle,resolveUnlocalizedTitle()now runs:deArrowTitleis already set (from browse card) → no-op.setVideo.Files Changed
UnlocalizedTitleData.javaUnlocalizedTitleProcessor.javaSuggestionsController.java