Browse Source

Adjust genre list context menu play (#239)

- Increase request size from 100 -> 500
- Use totalSongs count to determine when to stop (navidrome)
master
jeffvli 3 years ago
parent
commit
ff6b512340
  1. 8
      src/api/api.ts
  2. 6
      src/components/shared/ContextMenu.tsx

8
src/api/api.ts

@ -603,6 +603,7 @@ export const getSongsByGenre = async (
offset: number;
musicFolderId?: string | number;
recursive?: boolean;
totalSongs: number;
},
recursiveData: any[] = []
) => {
@ -617,7 +618,11 @@ export const getSongsByGenre = async (
},
})
.then((res) => {
if (!res.data.songsByGenre.song || res.data.songsByGenre.song.length === 0) {
if (
!res.data.songsByGenre.song ||
res.data.songsByGenre.song.length === 0 ||
options.totalSongs <= 0
) {
// Flatten and return once there are no more albums left
const flattenedSongs = _.flatten(recursiveData);
@ -637,6 +642,7 @@ export const getSongsByGenre = async (
offset: options.offset + options.size,
musicFolderId: options.musicFolderId,
recursive: true,
totalSongs: options.totalSongs - options.size,
},
recursiveData
);

6
src/components/shared/ContextMenu.tsx

@ -241,9 +241,10 @@ export const GlobalContextMenu = () => {
type: 'byGenre',
genre: multiSelect.selected[i].title,
musicFolderId: (folder.applied.music || folder.applied.albums) && folder.musicFolder,
size: 100,
size: 500,
offset: 0,
recursive: true,
totalSongs: multiSelect.selected[i]?.songCount,
},
})
);
@ -369,9 +370,10 @@ export const GlobalContextMenu = () => {
type: 'byGenre',
genre: multiSelect.selected[i].title,
musicFolderId: (folder.applied.album || folder.applied.artist) && folder.musicFolder,
size: 100,
size: 500,
offset: 0,
recursive: true,
totalSongs: multiSelect.selected[i]?.songCount,
},
})
);

Loading…
Cancel
Save