mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 10:03:33 +00:00
[enhancement]: Make related tab on full screen player useful
Resolves #50. Adds a new set of components for fetching similar songs from the current playing song. For Jellyfin, use the `/items/{itemId}/similar` endpoint (may not work well for small libraries), and for Navidrome/Subsonic use `getSimilarSongs`. _In theory_, this component can be used to get similar songs anywhere.
This commit is contained in:
parent
74075fc374
commit
025124c379
14 changed files with 247 additions and 16 deletions
|
|
@ -52,6 +52,8 @@ import type {
|
|||
ServerInfoArgs,
|
||||
StructuredLyricsArgs,
|
||||
StructuredLyric,
|
||||
SimilarSongsArgs,
|
||||
Song,
|
||||
} from '/@/renderer/api/types';
|
||||
import { ServerType } from '/@/renderer/types';
|
||||
import { DeletePlaylistResponse, RandomSongListArgs } from './types';
|
||||
|
|
@ -90,6 +92,7 @@ export type ControllerEndpoint = Partial<{
|
|||
getPlaylistSongList: (args: PlaylistSongListArgs) => Promise<SongListResponse>;
|
||||
getRandomSongList: (args: RandomSongListArgs) => Promise<SongListResponse>;
|
||||
getServerInfo: (args: ServerInfoArgs) => Promise<ServerInfo>;
|
||||
getSimilarSongs: (args: SimilarSongsArgs) => Promise<Song[]>;
|
||||
getSongDetail: (args: SongDetailArgs) => Promise<SongDetailResponse>;
|
||||
getSongList: (args: SongListArgs) => Promise<SongListResponse>;
|
||||
getStructuredLyrics: (args: StructuredLyricsArgs) => Promise<StructuredLyric[]>;
|
||||
|
|
@ -136,6 +139,7 @@ const endpoints: ApiController = {
|
|||
getPlaylistSongList: jfController.getPlaylistSongList,
|
||||
getRandomSongList: jfController.getRandomSongList,
|
||||
getServerInfo: jfController.getServerInfo,
|
||||
getSimilarSongs: jfController.getSimilarSongs,
|
||||
getSongDetail: jfController.getSongDetail,
|
||||
getSongList: jfController.getSongList,
|
||||
getStructuredLyrics: undefined,
|
||||
|
|
@ -174,6 +178,7 @@ const endpoints: ApiController = {
|
|||
getPlaylistSongList: ndController.getPlaylistSongList,
|
||||
getRandomSongList: ssController.getRandomSongList,
|
||||
getServerInfo: ssController.getServerInfo,
|
||||
getSimilarSongs: ssController.getSimilarSongs,
|
||||
getSongDetail: ndController.getSongDetail,
|
||||
getSongList: ndController.getSongList,
|
||||
getStructuredLyrics: ssController.getStructuredLyrics,
|
||||
|
|
@ -209,6 +214,7 @@ const endpoints: ApiController = {
|
|||
getPlaylistDetail: undefined,
|
||||
getPlaylistList: undefined,
|
||||
getServerInfo: ssController.getServerInfo,
|
||||
getSimilarSongs: ssController.getSimilarSongs,
|
||||
getSongDetail: undefined,
|
||||
getSongList: undefined,
|
||||
getStructuredLyrics: ssController.getStructuredLyrics,
|
||||
|
|
@ -511,6 +517,15 @@ const getStructuredLyrics = async (args: StructuredLyricsArgs) => {
|
|||
)?.(args);
|
||||
};
|
||||
|
||||
const getSimilarSongs = async (args: SimilarSongsArgs) => {
|
||||
return (
|
||||
apiController(
|
||||
'getSimilarSongs',
|
||||
args.apiClientProps.server?.type,
|
||||
) as ControllerEndpoint['getSimilarSongs']
|
||||
)?.(args);
|
||||
};
|
||||
|
||||
export const controller = {
|
||||
addToPlaylist,
|
||||
authenticate,
|
||||
|
|
@ -531,6 +546,7 @@ export const controller = {
|
|||
getPlaylistSongList,
|
||||
getRandomSongList,
|
||||
getServerInfo,
|
||||
getSimilarSongs,
|
||||
getSongDetail,
|
||||
getSongList,
|
||||
getStructuredLyrics,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue