mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
Cover art support for folder view (Subsonic servers only) (#1608)
* add coverArt support for subsonic folders
This commit is contained in:
@@ -778,6 +778,7 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
res.body.indexes?.index?.flatMap((idx) =>
|
||||
idx.artist.map((artist) => ({
|
||||
artist: artist.name,
|
||||
coverArt: artist.coverArt,
|
||||
id: artist.id.toString(),
|
||||
isDir: true,
|
||||
title: artist.name,
|
||||
|
||||
@@ -27,6 +27,9 @@ const ImageColumnBase = (props: ItemTableListInnerColumn) => {
|
||||
const internalState = (props as any).internalState;
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
|
||||
const isFolder = (rowItem as unknown as Folder)?._itemType === LibraryItem.FOLDER;
|
||||
const shouldShowFolderIcon = isFolder && !item?.imageId && !item?.imageUrl;
|
||||
|
||||
const handlePlay = (playType: Play, event: React.MouseEvent<HTMLButtonElement>) => {
|
||||
if (!item) {
|
||||
return;
|
||||
@@ -114,7 +117,7 @@ const ImageColumnBase = (props: ItemTableListInnerColumn) => {
|
||||
);
|
||||
}
|
||||
|
||||
if ((rowItem as unknown as Folder)?._itemType === LibraryItem.FOLDER) {
|
||||
if (shouldShowFolderIcon) {
|
||||
return (
|
||||
<TableColumnContainer {...props}>
|
||||
<Icon className={styles.folderIcon} icon="folder" size="2xl" />
|
||||
|
||||
@@ -399,6 +399,8 @@ const normalizeFolder = (
|
||||
songs: results?.songs || [],
|
||||
},
|
||||
id: item.id.toString(),
|
||||
imageId: item.coverArt?.toString() || null,
|
||||
imageUrl: null,
|
||||
name: item.title,
|
||||
parentId: item.parent,
|
||||
};
|
||||
|
||||
@@ -613,6 +613,7 @@ const getIndexes = z.object({
|
||||
.object({
|
||||
artist: z
|
||||
.object({
|
||||
coverArt: z.string().optional(),
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
})
|
||||
|
||||
@@ -257,6 +257,8 @@ export type Folder = {
|
||||
songs: Song[];
|
||||
};
|
||||
id: string;
|
||||
imageId?: null | string;
|
||||
imageUrl?: null | string;
|
||||
name: string;
|
||||
parentId?: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user