File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
MyMusicClientSveltePwa/src/lib Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 33 import { writable } from " svelte/store" ;
44 import { onDestroy , onMount , setContext } from " svelte" ;
55 import { getCachedPlaylistSongs } from " ../scripts/storageService" ;
6- import { playOrPauseSong , setPlaylists } from " ../scripts/playbackService" ;
6+ import { playOrPauseSong , setPlaylists , updateCurrentPlaylist } from " ../scripts/playbackService" ;
77 import SongComponent from " ../components/SongComponent.svelte" ;
88
99 const updateIntervalTimeOut = 1000 ; // Update every second
1919
2020 intervalId = setInterval (() => {
2121 songs .set (getCachedPlaylistSongs (playlistId));
22+ updateCurrentPlaylist (playlistId);
2223 }, updateIntervalTimeOut);
2324 });
2425
Original file line number Diff line number Diff line change @@ -165,6 +165,17 @@ export function setCurrentTime(seconds) {
165165 audioElement . currentTime = seconds ;
166166}
167167
168+ export function updateCurrentPlaylist ( playlistId ) {
169+ if ( currentPlaylistId === playlistId ) {
170+ // update current playlist
171+ originalPlaylistSongs = getCachedPlaylistSongs ( playlistId ) ;
172+
173+ // Todo get the difference between originalPlaylistSongs and playlistSongs
174+ // and update playlistSongs accordingly if shuffle is enabled
175+ return ; // Already set to this playlist
176+ }
177+ }
178+
168179export function setPlaylists ( playlistId ) {
169180 if ( currentPlaylistId === playlistId ) {
170181 // update current playlist
You can’t perform that action at this time.
0 commit comments