mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-06 20:10:12 +02:00
fix subsonic transcoding stream url to return raw string instead of fetch
This commit is contained in:
@@ -237,6 +237,27 @@ function appendTranscodeParams(url: string, format?: string, bitrate?: number) {
|
||||
return streamUrl;
|
||||
}
|
||||
|
||||
function buildGetTranscodeStreamUrl(
|
||||
server: null | undefined | { credential?: string; url?: string },
|
||||
args: {
|
||||
mediaId: string;
|
||||
mediaType: 'podcast' | 'song';
|
||||
offset: number;
|
||||
transcodeParams: string;
|
||||
},
|
||||
): string {
|
||||
const params = new URLSearchParams({
|
||||
c: 'Feishin',
|
||||
mediaId: args.mediaId,
|
||||
mediaType: args.mediaType,
|
||||
offset: String(args.offset),
|
||||
transcodeParams: args.transcodeParams,
|
||||
v: '1.13.0',
|
||||
});
|
||||
|
||||
return `${server?.url}/rest/getTranscodeStream.view?${params.toString()}&${server?.credential}`;
|
||||
}
|
||||
|
||||
function sortAndPaginate<T>(
|
||||
items: T[],
|
||||
options: {
|
||||
@@ -2013,20 +2034,14 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
return appendTranscodeParams(streamUrl, format, bitrate);
|
||||
}
|
||||
|
||||
const transcodeStreamUrl = await ssApiClient(apiClientProps).getTranscodeStream({
|
||||
query: {
|
||||
mediaId: id,
|
||||
mediaType,
|
||||
const transcodeStreamUrl = buildGetTranscodeStreamUrl(server, {
|
||||
mediaId: String(id),
|
||||
mediaType: (mediaType ?? 'song') as 'podcast' | 'song',
|
||||
offset: 0,
|
||||
transcodeParams: td.transcodeParams,
|
||||
},
|
||||
});
|
||||
|
||||
if (transcodeStreamUrl.status !== 200) {
|
||||
throw new Error('Failed to get transcode stream');
|
||||
}
|
||||
|
||||
return transcodeStreamUrl.body;
|
||||
return transcodeStreamUrl;
|
||||
}
|
||||
|
||||
return streamUrl;
|
||||
|
||||
Reference in New Issue
Block a user