Skip to content

Cache lyrics fetched from internet#184

Merged
theovilardo merged 2 commits intotheovilardo:masterfrom
thequantumquirk:lyrics-cache
Oct 4, 2025
Merged

Cache lyrics fetched from internet#184
theovilardo merged 2 commits intotheovilardo:masterfrom
thequantumquirk:lyrics-cache

Conversation

@thequantumquirk
Copy link
Contributor

@thequantumquirk thequantumquirk commented Oct 2, 2025

Lyrics Cache Issue & Fix

Problem:
When you sync lyrics from the internet and then switch songs, the lyrics changes get lost. The app wasn't saving the fetched lyrics in memory, so every time you switched back to a song, it had to reload lyrics from scratch.

Fix:
Created a lyrics cache that stores lyrics in memory using Android's LruCache. Now when you fetch lyrics from the internet, they get cached immediately. When you switch songs and come back, the lyrics are still there in the cache - no more lost changes.

How it works:

  • First time: Load lyrics → cache them → show lyrics
  • Next time: Check cache → lyrics found → show instantly
  • Cache holds 100 songs worth of lyrics and automatically removes old ones when full

The cache fixes the song-switching problem and makes lyrics load much faster.

Note: I'm not well proficient in Android Development and this code is assisted by AI. This is Tested and worked fine.

@thequantumquirk thequantumquirk changed the title feat: add LyricsRepository to cache lyrics fetched from internet Oct 2, 2025
@theovilardo theovilardo merged commit fa61587 into theovilardo:master Oct 4, 2025
@theovilardo
Copy link
Owner

Hi! Thanks for your contribution! This was a big issue I've been meaning to fix for a while, so it's really much appreciated 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants