diff --git a/src/renderer/api/controller.ts b/src/renderer/api/controller.ts index 63799c53..770e56fa 100644 --- a/src/renderer/api/controller.ts +++ b/src/renderer/api/controller.ts @@ -256,6 +256,15 @@ const getSongList = async (args: SongListArgs) => { )?.(args); }; +const getSongDetail = async (args: SongDetailArgs) => { + return ( + apiController( + 'getSongDetail', + args.apiClientProps.server?.type, + ) as ControllerEndpoint['getSongDetail'] + )?.(args); +}; + const getMusicFolderList = async (args: MusicFolderListArgs) => { return ( apiController( @@ -444,6 +453,7 @@ export const controller = { getPlaylistDetail, getPlaylistList, getPlaylistSongList, + getSongDetail, getSongList, getTopSongList, getUserList, diff --git a/src/renderer/api/query-keys.ts b/src/renderer/api/query-keys.ts index 1c3d9c01..dbed3868 100644 --- a/src/renderer/api/query-keys.ts +++ b/src/renderer/api/query-keys.ts @@ -11,6 +11,7 @@ import type { AlbumArtistDetailQuery, TopSongListQuery, SearchQuery, + SongDetailQuery, } from './types'; export const queryKeys = { @@ -88,6 +89,10 @@ export const queryKeys = { root: (serverId: string) => [serverId] as const, }, songs: { + detail: (serverId: string, query?: SongDetailQuery) => { + if (query) return [serverId, 'songs', 'detail', query] as const; + return [serverId, 'songs', 'detail'] as const; + }, list: (serverId: string, query?: SongListQuery) => { if (query) return [serverId, 'songs', 'list', query] as const; return [serverId, 'songs', 'list'] as const; diff --git a/src/renderer/api/subsonic/subsonic-controller.ts b/src/renderer/api/subsonic/subsonic-controller.ts index d17231ce..76c1d9b7 100644 --- a/src/renderer/api/subsonic/subsonic-controller.ts +++ b/src/renderer/api/subsonic/subsonic-controller.ts @@ -310,8 +310,6 @@ const scrobble = async (args: ScrobbleArgs): Promise => { const search3 = async (args: SearchArgs): Promise => { const { query, apiClientProps } = args; - console.log('search api'); - const res = await ssApiClient(apiClientProps).search3({ query: { albumCount: query.albumLimit, diff --git a/src/renderer/api/types.ts b/src/renderer/api/types.ts index 5d3a4f30..25a4b593 100644 --- a/src/renderer/api/types.ts +++ b/src/renderer/api/types.ts @@ -167,7 +167,7 @@ export type Album = { } & { songs?: Song[] }; export type Song = { - album: string; + album: string | undefined; albumArtists: RelatedArtist[]; albumId: string; artistName: string; @@ -971,6 +971,27 @@ export type SearchQuery = { songStartIndex?: number; }; +export type SearchSongsQuery = { + musicFolderId?: string; + query?: string; + songLimit?: number; + songStartIndex?: number; +}; + +export type SearchAlbumsQuery = { + albumLimit?: number; + albumStartIndex?: number; + musicFolderId?: string; + query?: string; +}; + +export type SearchAlbumArtistsQuery = { + albumArtistLimit?: number; + albumArtistStartIndex?: number; + musicFolderId?: string; + query?: string; +}; + export type SearchArgs = { query: SearchQuery; } & BaseEndpointArgs;