mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-08 21:10:12 +02:00
Fix server queue saving/restoring on Navidrome and OpenSubsonic (#1828)
* fix server queue saving * fix error when attempting to restore empty queue * queue items optional * make playQueueByIndex optional * fix incorrect error message
This commit is contained in:
@@ -1137,15 +1137,15 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
const res = await ssApiClient(apiClientProps).getPlayQueueByIndex();
|
||||
|
||||
if (res.status !== 200) {
|
||||
throw new Error('Failed to get random songs');
|
||||
throw new Error('Failed to get play queue');
|
||||
}
|
||||
|
||||
const { changed, changedBy, currentIndex, entry, position, username } =
|
||||
res.body.playQueueByIndex;
|
||||
res.body.playQueueByIndex || {}; // if there is no queue saved, playQueueByIndex may be undefined from a bug in Navidrome
|
||||
|
||||
return {
|
||||
changed,
|
||||
changedBy,
|
||||
changed: changed ?? '',
|
||||
changedBy: changedBy ?? '',
|
||||
currentIndex: currentIndex ?? 0,
|
||||
entry:
|
||||
entry?.map((song) =>
|
||||
@@ -1157,13 +1157,13 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
),
|
||||
) || [],
|
||||
positionMs: position ?? 0,
|
||||
username,
|
||||
username: username ?? '',
|
||||
};
|
||||
} else {
|
||||
const res = await ssApiClient(apiClientProps).getPlayQueue();
|
||||
|
||||
if (res.status !== 200) {
|
||||
throw new Error('Failed to get random songs');
|
||||
throw new Error('Failed to get play queue');
|
||||
}
|
||||
|
||||
const { changed, changedBy, current, entry, position, username } = res.body.playQueue;
|
||||
|
||||
Reference in New Issue
Block a user