Update album artist detail endpoints
This commit is contained in:
parent
ba0ec909c8
commit
c51194cd03
4 changed files with 32 additions and 2 deletions
|
@ -199,6 +199,12 @@ const getGenreList = async (args: GenreListArgs) => {
|
||||||
return (apiController('getGenreList') as ControllerEndpoint['getGenreList'])?.(args);
|
return (apiController('getGenreList') as ControllerEndpoint['getGenreList'])?.(args);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getAlbumArtistDetail = async (args: AlbumArtistDetailArgs) => {
|
||||||
|
return (apiController('getAlbumArtistDetail') as ControllerEndpoint['getAlbumArtistDetail'])?.(
|
||||||
|
args,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const getAlbumArtistList = async (args: AlbumArtistListArgs) => {
|
const getAlbumArtistList = async (args: AlbumArtistListArgs) => {
|
||||||
return (apiController('getAlbumArtistList') as ControllerEndpoint['getAlbumArtistList'])?.(args);
|
return (apiController('getAlbumArtistList') as ControllerEndpoint['getAlbumArtistList'])?.(args);
|
||||||
};
|
};
|
||||||
|
@ -254,6 +260,7 @@ export const controller = {
|
||||||
createPlaylist,
|
createPlaylist,
|
||||||
deleteFavorite,
|
deleteFavorite,
|
||||||
deletePlaylist,
|
deletePlaylist,
|
||||||
|
getAlbumArtistDetail,
|
||||||
getAlbumArtistList,
|
getAlbumArtistList,
|
||||||
getAlbumDetail,
|
getAlbumDetail,
|
||||||
getAlbumList,
|
getAlbumList,
|
||||||
|
|
|
@ -666,7 +666,7 @@ const normalizeSong = (
|
||||||
playCount: (item.UserData && item.UserData.PlayCount) || 0,
|
playCount: (item.UserData && item.UserData.PlayCount) || 0,
|
||||||
// releaseDate: (item.ProductionYear && new Date(item.ProductionYear, 0, 1).toISOString()) || null,
|
// releaseDate: (item.ProductionYear && new Date(item.ProductionYear, 0, 1).toISOString()) || null,
|
||||||
releaseDate: null,
|
releaseDate: null,
|
||||||
releaseYear: (item.ProductionYear && String(item.ProductionYear)) || null,
|
releaseYear: item.ProductionYear ? String(item.ProductionYear) : null,
|
||||||
serverId: server.id,
|
serverId: server.id,
|
||||||
serverType: ServerType.JELLYFIN,
|
serverType: ServerType.JELLYFIN,
|
||||||
size: item.MediaSources && item.MediaSources[0]?.Size,
|
size: item.MediaSources && item.MediaSources[0]?.Size,
|
||||||
|
|
|
@ -19,6 +19,8 @@ import type {
|
||||||
import { SSGenreList, SSMusicFolderList } from '/@/renderer/api/subsonic.types';
|
import { SSGenreList, SSMusicFolderList } from '/@/renderer/api/subsonic.types';
|
||||||
import type {
|
import type {
|
||||||
Album,
|
Album,
|
||||||
|
AlbumArtist,
|
||||||
|
RawAlbumArtistDetailResponse,
|
||||||
RawAlbumArtistListResponse,
|
RawAlbumArtistListResponse,
|
||||||
RawAlbumDetailResponse,
|
RawAlbumDetailResponse,
|
||||||
RawAlbumListResponse,
|
RawAlbumListResponse,
|
||||||
|
@ -149,6 +151,25 @@ const genreList = (data: RawGenreListResponse | undefined, server: ServerListIte
|
||||||
return genres;
|
return genres;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const albumArtistDetail = (
|
||||||
|
data: RawAlbumArtistDetailResponse | undefined,
|
||||||
|
server: ServerListItem | null,
|
||||||
|
): AlbumArtist | undefined => {
|
||||||
|
let albumArtist: AlbumArtist | undefined;
|
||||||
|
switch (server?.type) {
|
||||||
|
case 'jellyfin':
|
||||||
|
albumArtist = jfNormalize.albumArtist(data as JFAlbumArtist, server);
|
||||||
|
break;
|
||||||
|
case 'navidrome':
|
||||||
|
albumArtist = ndNormalize.albumArtist(data as NDAlbumArtist, server);
|
||||||
|
break;
|
||||||
|
case 'subsonic':
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return albumArtist;
|
||||||
|
};
|
||||||
|
|
||||||
const albumArtistList = (
|
const albumArtistList = (
|
||||||
data: RawAlbumArtistListResponse | undefined,
|
data: RawAlbumArtistListResponse | undefined,
|
||||||
server: ServerListItem | null,
|
server: ServerListItem | null,
|
||||||
|
@ -235,6 +256,7 @@ const userList = (data: RawUserListResponse | undefined, server: ServerListItem
|
||||||
};
|
};
|
||||||
|
|
||||||
export const normalize = {
|
export const normalize = {
|
||||||
|
albumArtistDetail,
|
||||||
albumArtistList,
|
albumArtistList,
|
||||||
albumDetail,
|
albumDetail,
|
||||||
albumList,
|
albumList,
|
||||||
|
|
|
@ -8,11 +8,12 @@ import type {
|
||||||
PlaylistDetailQuery,
|
PlaylistDetailQuery,
|
||||||
PlaylistSongListQuery,
|
PlaylistSongListQuery,
|
||||||
UserListQuery,
|
UserListQuery,
|
||||||
|
AlbumArtistDetailQuery,
|
||||||
} from './types';
|
} from './types';
|
||||||
|
|
||||||
export const queryKeys = {
|
export const queryKeys = {
|
||||||
albumArtists: {
|
albumArtists: {
|
||||||
detail: (serverId: string, query?: AlbumArtistListQuery) => {
|
detail: (serverId: string, query?: AlbumArtistDetailQuery) => {
|
||||||
if (query) return [serverId, 'albumArtists', 'detail', query] as const;
|
if (query) return [serverId, 'albumArtists', 'detail', query] as const;
|
||||||
return [serverId, 'albumArtists', 'detail'] as const;
|
return [serverId, 'albumArtists', 'detail'] as const;
|
||||||
},
|
},
|
||||||
|
|
Reference in a new issue