Skip to content

feat: Last.fm scrobbling and Now Playing integration#2563

Open
fiveclankers wants to merge 8 commits into
PixelPlayerHQ:masterfrom
fiveclankers:feat/lastfm-scrobbling
Open

feat: Last.fm scrobbling and Now Playing integration#2563
fiveclankers wants to merge 8 commits into
PixelPlayerHQ:masterfrom
fiveclankers:feat/lastfm-scrobbling

Conversation

@fiveclankers

@fiveclankers fiveclankers commented Jul 7, 2026

Copy link
Copy Markdown

adds Last.fm scrobbling + now playing to PixelPlayer

files changed:

  • LastFmModels.kt — data classes for the Last.fm API responses (auth, scrobble, now-playing)
  • LastFmApiService.kt — Retrofit interface, covers auth.getMobileSession, track.updateNowPlaying, track.scrobble
  • LastFmAuthHelper.kt — MD5 signature generation (required by Last.fm's API signing spec)
  • LastFmRepository.kt / LastFmRepositoryImpl.kt — handles login/logout, now playing updates and scrobbling, session persisted via DataStore
  • AppModule.kt — Hilt providers for the Last.fm retrofit instance, service, and repo
  • UserPreferencesRepository.kt — added lastfm_session_key, lastfm_username, lastfm_scrobbling_enabled keys with get/set/clear
  • DualPlayerEngine.ktonLastFmTrackStarted() starts the scrobble timer (fires at min(50% of track duration, 4 min), never before 30s — following Last.fm's rules) and calls updateNowPlaying
  • MusicService.kt — calls engine.onLastFmTrackStarted() from onMediaItemTransition via notifyLastFmNowPlaying()
  • AccountsViewModel.kt — added LAST_FM to the ExternalServiceAccount enum, wired up login/logout/result consumption

API calls are all signed with MD5 per the Last.fm docs: https://www.last.fm/api

not in this PR (coming next):

  • settings toggle for scrobbling
  • Last.fm login screen
  • offline scrobble queue/retry

Implements the buildLastFmSignature function to create the api_sig parameter for Last.fm API calls.
This interface defines methods for authenticating users and notifying Last.fm of track playback. It includes methods for mobile session authentication, updating the currently playing track, and scrobbling tracks.
…laying

This class manages Last.fm authentication, session key storage, and scrobbling operations. It includes methods for logging in, logging out, updating now playing, and scrobbling tracks.
…sitory

Added Last.fm session management functions and flows.
…Transition

Added notifyLastFmNowPlaying function to handle media item updates.
…Model

Added LastFmRepository integration for Last.fm authentication and account management.
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.

1 participant