Filter out songs not in the playlist
This commit is contained in:
@@ -26,7 +26,7 @@ const setTrack = (data) => ({
|
|||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
|
|
||||||
let filterAlbumSongs = function (data, ids) {
|
let filterSongs = function (data, ids) {
|
||||||
if (!ids) {
|
if (!ids) {
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ let filterAlbumSongs = function (data, ids) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const addTracks = (data, ids) => {
|
const addTracks = (data, ids) => {
|
||||||
const songs = filterAlbumSongs(data, ids)
|
const songs = filterSongs(data, ids)
|
||||||
return {
|
return {
|
||||||
type: PLAYER_ADD_TRACKS,
|
type: PLAYER_ADD_TRACKS,
|
||||||
data: songs,
|
data: songs,
|
||||||
@@ -53,7 +53,7 @@ const shuffle = (data) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const shuffleTracks = (data, ids) => {
|
const shuffleTracks = (data, ids) => {
|
||||||
const songs = filterAlbumSongs(data, ids)
|
const songs = filterSongs(data, ids)
|
||||||
const shuffled = shuffle(songs)
|
const shuffled = shuffle(songs)
|
||||||
const firstId = Object.keys(shuffled)[0]
|
const firstId = Object.keys(shuffled)[0]
|
||||||
return {
|
return {
|
||||||
@@ -64,7 +64,7 @@ const shuffleTracks = (data, ids) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const playTracks = (data, ids, selectedId) => {
|
const playTracks = (data, ids, selectedId) => {
|
||||||
const songs = filterAlbumSongs(data, ids)
|
const songs = filterSongs(data, ids)
|
||||||
return {
|
return {
|
||||||
type: PLAYER_PLAY_TRACKS,
|
type: PLAYER_PLAY_TRACKS,
|
||||||
id: selectedId || Object.keys(songs)[0],
|
id: selectedId || Object.keys(songs)[0],
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const PlaylistActions = ({
|
|||||||
<TopToolbar className={className} {...sanitizeListRestProps(rest)}>
|
<TopToolbar className={className} {...sanitizeListRestProps(rest)}>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
dispatch(playTracks(data))
|
dispatch(playTracks(data, ids))
|
||||||
}}
|
}}
|
||||||
label={translate('resources.album.actions.playAll')}
|
label={translate('resources.album.actions.playAll')}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user