mirror of
https://github.com/jeffvli/sonixd.git
synced 2026-04-29 10:42:40 -04:00
Add context menu play for genre list
This commit is contained in:
@@ -76,9 +76,6 @@ const GenreList = () => {
|
||||
listType="genre"
|
||||
virtualized
|
||||
disabledContextMenuOptions={[
|
||||
'play',
|
||||
'addToQueueNext',
|
||||
'addToQueueLast',
|
||||
'moveSelectedTo',
|
||||
'removeSelected',
|
||||
'addToPlaylist',
|
||||
|
||||
@@ -234,6 +234,36 @@ export const GlobalContextMenu = () => {
|
||||
dispatch(setStatus('PAUSED'));
|
||||
}
|
||||
|
||||
notifyToast('info', getPlayedSongsNotification({ ...songs.count, type: 'play' }));
|
||||
} else if (misc.contextMenu.type === 'genre') {
|
||||
for (let i = 0; i < multiSelect.selected.length; i += 1) {
|
||||
promises.push(
|
||||
apiController({
|
||||
serverType: config.serverType,
|
||||
endpoint: 'getSongsByGenre',
|
||||
args: {
|
||||
type: 'byGenre',
|
||||
genre: multiSelect.selected[i].title,
|
||||
musicFolderId: musicFolder,
|
||||
size: 100,
|
||||
offset: 0,
|
||||
recursive: true,
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
const res = await Promise.all(promises);
|
||||
const songs = filterPlayQueue(config.playback.filters, _.flatten(_.map(res, 'data')));
|
||||
if (songs.entries.length > 0) {
|
||||
dispatch(setPlayQueue({ entries: songs.entries }));
|
||||
dispatch(setStatus('PLAYING'));
|
||||
dispatch(fixPlayer2Index());
|
||||
} else {
|
||||
dispatch(clearPlayQueue());
|
||||
dispatch(setStatus('PAUSED'));
|
||||
}
|
||||
|
||||
notifyToast('info', getPlayedSongsNotification({ ...songs.count, type: 'play' }));
|
||||
}
|
||||
};
|
||||
@@ -329,6 +359,33 @@ export const GlobalContextMenu = () => {
|
||||
dispatch(fixPlayer2Index());
|
||||
}
|
||||
|
||||
notifyToast('info', getPlayedSongsNotification({ ...songs.count, type: 'add' }));
|
||||
} else if (misc.contextMenu.type === 'genre') {
|
||||
for (let i = 0; i < multiSelect.selected.length; i += 1) {
|
||||
promises.push(
|
||||
apiController({
|
||||
serverType: config.serverType,
|
||||
endpoint: 'getSongsByGenre',
|
||||
args: {
|
||||
type: 'byGenre',
|
||||
genre: multiSelect.selected[i].title,
|
||||
musicFolderId: musicFolder,
|
||||
size: 100,
|
||||
offset: 0,
|
||||
recursive: true,
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
const res = await Promise.all(promises);
|
||||
const songs = filterPlayQueue(config.playback.filters, _.flatten(_.map(res, 'data')));
|
||||
|
||||
if (songs.entries.length > 0) {
|
||||
dispatch(appendPlayQueue({ entries: songs.entries, type }));
|
||||
dispatch(fixPlayer2Index());
|
||||
}
|
||||
|
||||
notifyToast('info', getPlayedSongsNotification({ ...songs.count, type: 'add' }));
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user