Repository navigation
feat(player): add local music player, configurable autoplay, and playlist sync/dedup fixes - #290
Closed
Arunkumar-Anbazhagan wants to merge 2 commits into
Closed
Arunkumar-Anbazhagan wants to merge 2 commits into
Arunkumar-Anbazhagan wants to merge 2 commits into
Conversation
…songs - Enhanced song identity matching with title/artist cleaning to recognize variants - Fixed playlist track removal by preserving exact original index during sort/filter - Added atomic deduplicate method to PlaylistRepository and one-tap action in PlaylistDetailScreen - Deduplicated library playlists in YtMusicLibraryManager and ViewModel - Added unit tests for track identity matching and deduplication
…st playlist sync - Local Music Player: - Add READ_MEDIA_AUDIO permission and intent filter for audio/* files - Handle ACTION_VIEW intent in MainActivity with MediaMetadataRetriever - Create LocalAudioRepository for querying MediaStore.Audio - Create LocalMusicScreen and LocalMusicViewModel with search, sorting, and playback actions - Add Device Music navigation card in PlaylistScreen and register route in NavGraph and MainShell - Autoplay / Auto-add Control: - Add autoplayEnabled toggle in SettingsPreferences and SettingsScreen - Gate automatic radio track queue injection behind autoplay preference in MusicPlayer - Playlist Sync Reliability: - Prevent drops of non-exact matched tracks in YtMusicSyncManager - Persist resolved YouTube video URLs to avoid repeated re-resolutions - Make remote playlist fetch and updates robust against concurrent sync passes
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.
Summary
This PR addresses several community-requested player and playlist improvements:
falseso playback stops as expected).Key Changes & Implementations
1. Local Music Player (
feat)LocalAudioRepositoryqueryingMediaStore.Audio.Media.EXTERNAL_CONTENT_URIwith proper runtime permission handling (READ_MEDIA_AUDIOon Android 13+ / API 33+ and legacy storage fallback).LocalMusicScreenandLocalMusicViewModelfeaturing:PlaylistScreenand registered the route inNavGraphandMainShell.ACTION_VIEWintent filter foraudio/*inAndroidManifest.xmland handled playback withMediaMetadataRetrieverinMainActivityso tapping audio files in file managers plays them directly in LastWave.2. Playlist Track Deletion Index Fix (
fix)PlaylistDetailScreen, deleting a song passed the filtered/sorted index (displayIndex) directly toplaylistRepository.removeTrackAt(), causing the wrong track to be deleted whenever the list was searched or reordered.IndexedDisplayTrackpairing every display track with its original unshifted index (originalIndex). Deletions now target the exact index in the underlying playlist model.3. Song Identity Matching & Playlist Deduplication (
feat/fix)cleanCoreTitle()andcleanCoreArtist()inGeneratedTrack.ktto strip noisy metadata tags (e.g.,(Remastered ...),[Deluxe Edition],feat. ...,[Official Audio]).deduplicate(playlistId)inPlaylistRepositoryand exposed it via the playlist detail menu, preserving user-pinned tracks and video IDs while eliminating duplicate entries.TrackIdentityTest.ktverifying variant matching and deduplication behavior.4. Configurable Autoplay / Endless Queue Control (
fix/feat)MusicPlayer.ktunconditionally initiated an endless radio queue, injecting 35 tracks and continuing playback without user consent.autoplayEnabled: Boolean = falsepreference inSettingsPreferencesand exposed an "Autoplay similar tracks" toggle under Settings → Audio.MusicPlayer.ktso playback cleanly stops at the end of a queue/playlist unless the user explicitly toggles autoplay on.5. YouTube Music Playlist Sync Drop Fix (
fix)YtMusicSyncManager.ktfiltered additions with&& it in exactVideoIds, which dropped tracks added from Last.fm, Discover, search, or local import whose video IDs were resolved after creation.https://music.youtube.com/watch?v=$videoId) directly onto synced tracks, preventing repeated resolution calls and ensuring sync parity with remote YouTube Music playlists.Verification & Testing
./gradlew.bat testDebugUnitTest— all unit tests pass with zero regressions../gradlew.bat assembleRelease— compiles cleanly with R8 optimization (~23.8 MB).upstream/main(b6db40a) with linear git history and no merge conflicts.Modified & Added Files
AndroidManifest.xmlMainActivity.ktLocalAudioRepository.kt(new)SettingsPreferences.ktYtMusicSyncManager.ktPlaylistRepository.ktYtMusicLibraryManager.ktGeneratedTrack.ktMusicPlayer.ktLocalMusicScreen.kt(new)LocalMusicViewModel.kt(new)PlaylistScreen.ktPlaylistDetailScreen.ktPlaylistViewModel.ktSettingsScreen.ktSettingsViewModel.ktNavGraph.ktScreen.ktMainShell.ktPlayerHost.ktTrackIdentityTest.kt