Skip to content

Commit 28d1a79

Browse files
committed
woops
1 parent f418aa1 commit 28d1a79

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

MyMusicClientSveltePwa/src/lib/pages/Playlist.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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
@@ -19,6 +19,7 @@
1919
2020
intervalId = setInterval(() => {
2121
songs.set(getCachedPlaylistSongs(playlistId));
22+
updateCurrentPlaylist(playlistId);
2223
}, updateIntervalTimeOut);
2324
});
2425

MyMusicClientSveltePwa/src/lib/scripts/playbackService.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
168179
export function setPlaylists(playlistId) {
169180
if (currentPlaylistId === playlistId) {
170181
// update current playlist

0 commit comments

Comments
 (0)