From 0becfd4b59f7f9a08a9df0f4807f3edf944358ab Mon Sep 17 00:00:00 2001 From: Kendall Garner <17521368+kgarner7@users.noreply.github.com> Date: Tue, 8 Jul 2025 08:30:31 -0700 Subject: [PATCH] subsonic limit to 500 --- src/renderer/api/subsonic/subsonic-controller.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/renderer/api/subsonic/subsonic-controller.ts b/src/renderer/api/subsonic/subsonic-controller.ts index 0803936f..a850f729 100644 --- a/src/renderer/api/subsonic/subsonic-controller.ts +++ b/src/renderer/api/subsonic/subsonic-controller.ts @@ -46,6 +46,8 @@ const ALBUM_LIST_SORT_MAPPING: Record { const res = await ssApiClient(apiClientProps).updatePlaylist({ @@ -1128,17 +1130,17 @@ export const SubsonicController: ControllerEndpoint = { if (numberOfResults !== 1) { fetchNextSection = false; - startIndex = sectionIndex === 0 ? 0 : sectionIndex - 5000; + startIndex = sectionIndex === 0 ? 0 : sectionIndex - BATCH_SIZE; break; } else { - sectionIndex += 5000; + sectionIndex += BATCH_SIZE; } } while (fetchNextPage) { const res = await ssApiClient(apiClientProps).getSongsByGenre({ query: { - count: 500, + count: BATCH_SIZE, genre: query.genreIds[0], musicFolderId: query.musicFolderId, offset: startIndex, @@ -1195,13 +1197,13 @@ export const SubsonicController: ControllerEndpoint = { const numberOfResults = (res.body.searchResult3?.song || []).length || 0; - // Check each batch of 5000 songs to check for data - sectionIndex += 5000; + // Check each batch of 500 songs to check for data + sectionIndex += BATCH_SIZE; fetchNextSection = numberOfResults === 1; if (!fetchNextSection) { - // fetchNextBlock will be false on the next loop so we need to subtract 5000 * 2 - startIndex = sectionIndex - 10000; + // fetchNextBlock will be false on the next loop so we need to subtract 2 * BATCH_SIZE + startIndex = sectionIndex - 2 * BATCH_SIZE; } }