Browse Source

refactor(Stations): Refill queue move current song filter to currentYoutubeIds

Owen Diffey 3 years ago
parent
commit
22f43d8ffc
1 changed files with 5 additions and 3 deletions
  1. 5 3
      backend/logic/stations.js

+ 5 - 3
backend/logic/stations.js

@@ -479,14 +479,13 @@ class _StationsModule extends CoreClass {
 					},
 
 					(playlist, station, next) => {
-						const songs = playlist.songs.filter(song => song._id !== station.currentSong._id);
 						if (station.playMode === "random") {
-							UtilsModule.runJob("SHUFFLE", { array: songs }, this)
+							UtilsModule.runJob("SHUFFLE", { array: playlist.songs }, this)
 								.then(response => {
 									next(null, response.array, station);
 								})
 								.catch(next);
-						} else next(null, songs, station);
+						} else next(null, playlist.songs, station);
 					},
 
 					(_playlistSongs, station, next) => {
@@ -503,6 +502,9 @@ class _StationsModule extends CoreClass {
 						const songsToAdd = [];
 						let lastSongAdded = null;
 
+						if (station.currentSong && station.currentSong.youtubeId)
+							currentYoutubeIds.push(station.currentSong.youtubeId);
+
 						playlistSongs.every(song => {
 							if (
 								songsToAdd.length < songsStillNeeded &&