mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-23 10:56:28 +02:00
support navidrome playlist image upload
This commit is contained in:
@@ -490,6 +490,8 @@ const normalizePlaylist = (
|
||||
item: z.infer<typeof ndType._response.playlist>,
|
||||
server?: null | ServerListItem,
|
||||
): Playlist => {
|
||||
const imageId = !item.uploadedImage ? item.id : `pl-${item.id}&square=true&_=${item.updatedAt}`;
|
||||
|
||||
return {
|
||||
_itemType: LibraryItem.PLAYLIST,
|
||||
_serverId: server?.id || 'unknown',
|
||||
@@ -498,7 +500,7 @@ const normalizePlaylist = (
|
||||
duration: item.duration * 1000,
|
||||
genres: [],
|
||||
id: item.id,
|
||||
imageId: item.id,
|
||||
imageId,
|
||||
imageUrl: null,
|
||||
name: item.name,
|
||||
owner: item.ownerName,
|
||||
@@ -508,6 +510,7 @@ const normalizePlaylist = (
|
||||
size: item.size,
|
||||
songCount: item.songCount,
|
||||
sync: item.sync,
|
||||
uploadedImage: item.uploadedImage,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -624,6 +624,7 @@ const playlist = z.object({
|
||||
songCount: z.number(),
|
||||
sync: z.boolean(),
|
||||
updatedAt: z.string(),
|
||||
uploadedImage: z.string().optional(),
|
||||
});
|
||||
|
||||
const playlistList = z.array(playlist);
|
||||
@@ -659,6 +660,18 @@ const updatePlaylist = playlist;
|
||||
|
||||
const updatePlaylistParameters = createPlaylistParameters.partial();
|
||||
|
||||
const uploadPlaylistImage = z.object({
|
||||
status: z.string(),
|
||||
});
|
||||
|
||||
const uploadPlaylistImageParameters = z.object({
|
||||
image: z.instanceof(Uint8Array),
|
||||
});
|
||||
|
||||
const deletePlaylistImage = z.object({
|
||||
status: z.string(),
|
||||
});
|
||||
|
||||
const deletePlaylist = z.null();
|
||||
|
||||
const addToPlaylist = z.object({
|
||||
@@ -760,6 +773,7 @@ export const ndType = {
|
||||
songList: songListParameters,
|
||||
tagList: tagListParameters,
|
||||
updatePlaylist: updatePlaylistParameters,
|
||||
uploadPlaylistImage: uploadPlaylistImageParameters,
|
||||
userList: userListParameters,
|
||||
},
|
||||
_response: {
|
||||
@@ -771,6 +785,7 @@ export const ndType = {
|
||||
authenticate,
|
||||
createPlaylist,
|
||||
deletePlaylist,
|
||||
deletePlaylistImage,
|
||||
error,
|
||||
genre,
|
||||
genreList,
|
||||
@@ -787,6 +802,7 @@ export const ndType = {
|
||||
songList,
|
||||
tagList,
|
||||
updatePlaylist,
|
||||
uploadPlaylistImage,
|
||||
user,
|
||||
userList,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user