mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-14 20:40:21 +02:00
add folder browsing support (#315)
This commit is contained in:
@@ -4,6 +4,7 @@ import { jfType } from '/@/shared/api/jellyfin/jellyfin-types';
|
||||
import {
|
||||
Album,
|
||||
AlbumArtist,
|
||||
Folder,
|
||||
Genre,
|
||||
LibraryItem,
|
||||
MusicFolder,
|
||||
@@ -496,17 +497,20 @@ const normalizeGenre = (
|
||||
};
|
||||
};
|
||||
|
||||
// const normalizeFolder = (item: any) => {
|
||||
// return {
|
||||
// created: item.DateCreated,
|
||||
// id: item.Id,
|
||||
// image: getCoverArtUrl(item, 150),
|
||||
// isDir: true,
|
||||
// title: item.Name,
|
||||
// type: Item.Folder,
|
||||
// uniqueId: nanoid(),
|
||||
// };
|
||||
// };
|
||||
const normalizeFolder = (
|
||||
item: z.infer<typeof jfType._response.folder>,
|
||||
server: null | ServerListItem,
|
||||
): Folder => {
|
||||
return {
|
||||
_itemType: LibraryItem.FOLDER,
|
||||
_serverId: server?.id || 'unknown',
|
||||
_serverType: ServerType.JELLYFIN,
|
||||
children: undefined,
|
||||
id: item.Id,
|
||||
name: item.Name || 'Unknown folder',
|
||||
parentId: item.ParentId,
|
||||
};
|
||||
};
|
||||
|
||||
// const normalizeScanStatus = () => {
|
||||
// return {
|
||||
@@ -518,6 +522,7 @@ const normalizeGenre = (
|
||||
export const jfNormalize = {
|
||||
album: normalizeAlbum,
|
||||
albumArtist: normalizeAlbumArtist,
|
||||
folder: normalizeFolder,
|
||||
genre: normalizeGenre,
|
||||
musicFolder: normalizeMusicFolder,
|
||||
playlist: normalizePlaylist,
|
||||
|
||||
@@ -487,6 +487,7 @@ const song = z.object({
|
||||
MediaType: z.string(),
|
||||
Name: z.string(),
|
||||
NormalizationGain: z.number().optional(),
|
||||
ParentId: z.string().optional(),
|
||||
ParentIndexNumber: z.number(),
|
||||
People: participant.array().optional(),
|
||||
PlaylistItemId: z.string().optional(),
|
||||
@@ -495,7 +496,7 @@ const song = z.object({
|
||||
ProviderIds: providerIds.optional(),
|
||||
RunTimeTicks: z.number(),
|
||||
ServerId: z.string(),
|
||||
SortName: z.string(),
|
||||
SortName: z.string().optional(),
|
||||
Tags: z.string().array().optional(),
|
||||
Type: z.string(),
|
||||
UserData: userData.optional(),
|
||||
@@ -772,6 +773,34 @@ const filters = z.object({
|
||||
Years: z.number().array().optional(),
|
||||
});
|
||||
|
||||
const folder = z.object({
|
||||
BackdropImageTags: z.array(z.string()),
|
||||
ChannelId: z.null(),
|
||||
CollectionType: z.string(),
|
||||
Id: z.string(),
|
||||
ImageBlurHashes: imageBlurHashes,
|
||||
ImageTags: imageTags,
|
||||
IsFolder: z.boolean(),
|
||||
LocationType: z.string(),
|
||||
MediaType: z.string(),
|
||||
Name: z.string(),
|
||||
ParentId: z.string().optional(),
|
||||
ServerId: z.string(),
|
||||
Type: z.string(),
|
||||
UserData: userData.optional(),
|
||||
});
|
||||
|
||||
const folderList = pagination.extend({
|
||||
Items: z.array(folder),
|
||||
});
|
||||
|
||||
const folderParameters = z.object({
|
||||
Fields: z.string().optional(),
|
||||
ParentId: z.string().optional(),
|
||||
SortBy: z.string().optional(),
|
||||
SortOrder: z.enum(sortOrderValues).optional(),
|
||||
});
|
||||
|
||||
export const jfType = {
|
||||
_enum: {
|
||||
albumArtistList: albumArtistListSort,
|
||||
@@ -794,6 +823,7 @@ export const jfType = {
|
||||
deletePlaylist: deletePlaylistParameters,
|
||||
favorite: favoriteParameters,
|
||||
filterList: filterListParameters,
|
||||
folder: folderParameters,
|
||||
genreList: genreListParameters,
|
||||
musicFolderList: musicFolderListParameters,
|
||||
playlistDetail: playlistDetailParameters,
|
||||
@@ -819,6 +849,8 @@ export const jfType = {
|
||||
error,
|
||||
favorite,
|
||||
filters,
|
||||
folder,
|
||||
folderList,
|
||||
genre,
|
||||
genreList,
|
||||
lyrics,
|
||||
|
||||
Reference in New Issue
Block a user