From 8b4bbc1ede3366f78f9d344a22d79404e32cb178 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Tue, 31 Mar 2026 11:30:32 -0700 Subject: [PATCH] remove serverFeatures and transcode from api context --- src/renderer/api/controller.ts | 14 -------------- .../api/subsonic/subsonic-controller.ts | 17 +++++++++-------- src/shared/types/domain-types.ts | 6 ------ 3 files changed, 9 insertions(+), 28 deletions(-) diff --git a/src/renderer/api/controller.ts b/src/renderer/api/controller.ts index 974492843..1debe99ed 100644 --- a/src/renderer/api/controller.ts +++ b/src/renderer/api/controller.ts @@ -67,28 +67,14 @@ const getPathReplaceSettings = () => { return { pathReplace, pathReplaceWith }; }; -const getTranscodeSettings = () => { - const transcode = useSettingsStore.getState().playback.transcode; - return transcode; -}; - -const getServerFeatures = () => { - const serverFeatures = useAuthStore.getState().currentServer?.features; - return serverFeatures; -}; - const addContext = (args: T): T => { const pathSettings = getPathReplaceSettings(); - const transcodeSettings = getTranscodeSettings(); - const serverFeatures = getServerFeatures(); return { ...args, context: { ...(args.context || {}), ...pathSettings, - serverFeatures: serverFeatures, - transcode: transcodeSettings, }, }; }; diff --git a/src/renderer/api/subsonic/subsonic-controller.ts b/src/renderer/api/subsonic/subsonic-controller.ts index a9c136e53..5a7d7e59c 100644 --- a/src/renderer/api/subsonic/subsonic-controller.ts +++ b/src/renderer/api/subsonic/subsonic-controller.ts @@ -1951,10 +1951,9 @@ export const SubsonicController: InternalControllerEndpoint = { return totalRecordCount; }, - getStreamUrl: async ({ apiClientProps, context, query }) => { + getStreamUrl: async ({ apiClientProps, query }) => { const { server } = apiClientProps; const { bitrate, format, id, mediaType = 'song', transcode } = query; - const { serverFeatures, transcode: transcodeSettings } = context || {}; const streamUrl = `${server?.url}/rest/stream.view?id=${id}&v=1.13.0&c=Feishin&${server?.credential}`; @@ -1964,13 +1963,15 @@ export const SubsonicController: InternalControllerEndpoint = { } // If the server supports transcoding decision, always use it to determine if we need to transcode - if (serverFeatures?.[ServerFeature.OS_TRANSCODE_DECISION]) { - const maxTranscodingAudioBitrate = transcodeSettings?.bitrate || 0; + if (hasFeature(server, ServerFeature.OS_TRANSCODE_DECISION)) { + const maxTranscodingAudioBitrate = 0; + + const transcodingProfiles = format?.split(',').map((f) => { + const trimmedFormat = f.trim(); - const transcodingProfiles = (transcodeSettings?.format || []).map((format) => { return { - audioCodec: format, - container: format, + audioCodec: trimmedFormat, + container: trimmedFormat, maxAudioChannels: 2, protocol: 'http', }; @@ -1980,7 +1981,7 @@ export const SubsonicController: InternalControllerEndpoint = { body: { codecProfiles: [], directPlayProfiles: TRANSCODE_DIRECT_PLAY_PROFILES, - maxAudioBitrate: 512000, + maxAudioBitrate: 0, maxTranscodingAudioBitrate, name: 'Feishin', platform: 'Web', diff --git a/src/shared/types/domain-types.ts b/src/shared/types/domain-types.ts index 8fd0626c3..1c53cf132 100644 --- a/src/shared/types/domain-types.ts +++ b/src/shared/types/domain-types.ts @@ -413,12 +413,6 @@ export type Song = { type ApiContext = { pathReplace?: string; pathReplaceWith?: string; - serverFeatures?: ServerFeatures; - transcode?: { - bitrate?: number; - enabled?: boolean; - format?: string[]; - }; }; type BaseEndpointArgs = {