mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
fix jellyfin playlists, add is public
This commit is contained in:
parent
528bef01f0
commit
93377dcc4f
11 changed files with 81 additions and 51 deletions
|
|
@ -4,6 +4,7 @@ export enum ServerFeature {
|
|||
LYRICS_MULTIPLE_STRUCTURED = 'lyricsMultipleStructured',
|
||||
LYRICS_SINGLE_STRUCTURED = 'lyricsSingleStructured',
|
||||
PLAYLISTS_SMART = 'playlistsSmart',
|
||||
PUBLIC_PLAYLIST = 'publicPlaylist',
|
||||
SHARING_ALBUM_SONG = 'sharingAlbumSong',
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -292,8 +292,8 @@ export const contract = c.router({
|
|||
},
|
||||
updatePlaylist: {
|
||||
body: jfType._parameters.updatePlaylist,
|
||||
method: 'PUT',
|
||||
path: 'items/:id',
|
||||
method: 'POST',
|
||||
path: 'playlists/:id',
|
||||
responses: {
|
||||
200: jfType._response.updatePlaylist,
|
||||
400: jfType._response.error,
|
||||
|
|
|
|||
|
|
@ -607,9 +607,9 @@ const createPlaylist = async (args: CreatePlaylistArgs): Promise<CreatePlaylistR
|
|||
|
||||
const res = await jfApiClient(apiClientProps).createPlaylist({
|
||||
body: {
|
||||
IsPublic: body.public,
|
||||
MediaType: 'Audio',
|
||||
Name: body.name,
|
||||
Overview: body.comment || '',
|
||||
UserId: apiClientProps.server.userId,
|
||||
},
|
||||
});
|
||||
|
|
@ -633,9 +633,9 @@ const updatePlaylist = async (args: UpdatePlaylistArgs): Promise<UpdatePlaylistR
|
|||
const res = await jfApiClient(apiClientProps).updatePlaylist({
|
||||
body: {
|
||||
Genres: body.genres?.map((item) => ({ Id: item.id, Name: item.name })) || [],
|
||||
IsPublic: body.public,
|
||||
MediaType: 'Audio',
|
||||
Name: body.name,
|
||||
Overview: body.comment || '',
|
||||
PremiereDate: null,
|
||||
ProviderIds: {},
|
||||
Tags: [],
|
||||
|
|
@ -646,7 +646,7 @@ const updatePlaylist = async (args: UpdatePlaylistArgs): Promise<UpdatePlaylistR
|
|||
},
|
||||
});
|
||||
|
||||
if (res.status !== 200) {
|
||||
if (res.status !== 204) {
|
||||
throw new Error('Failed to update playlist');
|
||||
}
|
||||
|
||||
|
|
@ -954,7 +954,12 @@ const getSongDetail = async (args: SongDetailArgs): Promise<SongDetailResponse>
|
|||
return jfNormalize.song(res.body, apiClientProps.server, '');
|
||||
};
|
||||
|
||||
const VERSION_INFO: VersionInfo = [['10.9.0', { [ServerFeature.LYRICS_SINGLE_STRUCTURED]: [1] }]];
|
||||
const VERSION_INFO: VersionInfo = [
|
||||
[
|
||||
'10.9.0',
|
||||
{ [ServerFeature.LYRICS_SINGLE_STRUCTURED]: [1], [ServerFeature.PUBLIC_PLAYLIST]: [1] },
|
||||
],
|
||||
];
|
||||
|
||||
const getServerInfo = async (args: ServerInfoArgs): Promise<ServerInfo> => {
|
||||
const { apiClientProps } = args;
|
||||
|
|
|
|||
|
|
@ -581,9 +581,9 @@ const playlistDetailParameters = baseParameters.extend({
|
|||
});
|
||||
|
||||
const createPlaylistParameters = z.object({
|
||||
IsPublic: z.boolean().optional(),
|
||||
MediaType: z.literal('Audio'),
|
||||
Name: z.string(),
|
||||
Overview: z.string(),
|
||||
UserId: z.string(),
|
||||
});
|
||||
|
||||
|
|
@ -595,9 +595,9 @@ const updatePlaylist = z.null();
|
|||
|
||||
const updatePlaylistParameters = z.object({
|
||||
Genres: z.array(genreItem),
|
||||
IsPublic: z.boolean().optional(),
|
||||
MediaType: z.literal('Audio'),
|
||||
Name: z.string(),
|
||||
Overview: z.string(),
|
||||
PremiereDate: z.null(),
|
||||
ProviderIds: z.object({}),
|
||||
Tags: z.array(genericItem),
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ const createPlaylist = async (args: CreatePlaylistArgs): Promise<CreatePlaylistR
|
|||
body: {
|
||||
comment: body.comment,
|
||||
name: body.name,
|
||||
public: body._custom?.navidrome?.public,
|
||||
public: body.public,
|
||||
rules: body._custom?.navidrome?.rules,
|
||||
sync: body._custom?.navidrome?.sync,
|
||||
},
|
||||
|
|
@ -339,7 +339,7 @@ const updatePlaylist = async (args: UpdatePlaylistArgs): Promise<UpdatePlaylistR
|
|||
body: {
|
||||
comment: body.comment || '',
|
||||
name: body.name,
|
||||
public: body._custom?.navidrome?.public || false,
|
||||
public: body?.public || false,
|
||||
rules: body._custom?.navidrome?.rules ? body._custom.navidrome.rules : undefined,
|
||||
sync: body._custom?.navidrome?.sync || undefined,
|
||||
},
|
||||
|
|
@ -534,6 +534,7 @@ const getServerInfo = async (args: ServerInfoArgs): Promise<ServerInfo> => {
|
|||
const features: ServerFeatures = {
|
||||
lyricsMultipleStructured: !!navidromeFeatures[SubsonicExtensions.SONG_LYRICS],
|
||||
playlistsSmart: !!navidromeFeatures[ServerFeature.PLAYLISTS_SMART],
|
||||
publicPlaylist: true,
|
||||
sharingAlbumSong: !!navidromeFeatures[ServerFeature.SHARING_ALBUM_SONG],
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -818,13 +818,13 @@ export type CreatePlaylistBody = {
|
|||
navidrome?: {
|
||||
owner?: string;
|
||||
ownerId?: string;
|
||||
public?: boolean;
|
||||
rules?: Record<string, any>;
|
||||
sync?: boolean;
|
||||
};
|
||||
};
|
||||
comment?: string;
|
||||
name: string;
|
||||
public?: boolean;
|
||||
};
|
||||
|
||||
export type CreatePlaylistArgs = { body: CreatePlaylistBody; serverId?: string } & BaseEndpointArgs;
|
||||
|
|
@ -841,7 +841,6 @@ export type UpdatePlaylistBody = {
|
|||
navidrome?: {
|
||||
owner?: string;
|
||||
ownerId?: string;
|
||||
public?: boolean;
|
||||
rules?: Record<string, any>;
|
||||
sync?: boolean;
|
||||
};
|
||||
|
|
@ -849,6 +848,7 @@ export type UpdatePlaylistBody = {
|
|||
comment?: string;
|
||||
genres?: Genre[];
|
||||
name: string;
|
||||
public?: boolean;
|
||||
};
|
||||
|
||||
export type UpdatePlaylistArgs = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue