Cover art support for folder view (Subsonic servers only) (#1608)

* add coverArt support for subsonic folders
This commit is contained in:
marank
2026-01-24 06:26:51 +01:00
committed by GitHub
parent c79e041777
commit f016d2cdf4
5 changed files with 10 additions and 1 deletions
@@ -778,6 +778,7 @@ export const SubsonicController: InternalControllerEndpoint = {
res.body.indexes?.index?.flatMap((idx) => res.body.indexes?.index?.flatMap((idx) =>
idx.artist.map((artist) => ({ idx.artist.map((artist) => ({
artist: artist.name, artist: artist.name,
coverArt: artist.coverArt,
id: artist.id.toString(), id: artist.id.toString(),
isDir: true, isDir: true,
title: artist.name, title: artist.name,
@@ -27,6 +27,9 @@ const ImageColumnBase = (props: ItemTableListInnerColumn) => {
const internalState = (props as any).internalState; const internalState = (props as any).internalState;
const [isHovered, setIsHovered] = useState(false); 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>) => { const handlePlay = (playType: Play, event: React.MouseEvent<HTMLButtonElement>) => {
if (!item) { if (!item) {
return; return;
@@ -114,7 +117,7 @@ const ImageColumnBase = (props: ItemTableListInnerColumn) => {
); );
} }
if ((rowItem as unknown as Folder)?._itemType === LibraryItem.FOLDER) { if (shouldShowFolderIcon) {
return ( return (
<TableColumnContainer {...props}> <TableColumnContainer {...props}>
<Icon className={styles.folderIcon} icon="folder" size="2xl" /> <Icon className={styles.folderIcon} icon="folder" size="2xl" />
@@ -399,6 +399,8 @@ const normalizeFolder = (
songs: results?.songs || [], songs: results?.songs || [],
}, },
id: item.id.toString(), id: item.id.toString(),
imageId: item.coverArt?.toString() || null,
imageUrl: null,
name: item.title, name: item.title,
parentId: item.parent, parentId: item.parent,
}; };
@@ -613,6 +613,7 @@ const getIndexes = z.object({
.object({ .object({
artist: z artist: z
.object({ .object({
coverArt: z.string().optional(),
id: z.string(), id: z.string(),
name: z.string(), name: z.string(),
}) })
+2
View File
@@ -257,6 +257,8 @@ export type Folder = {
songs: Song[]; songs: Song[];
}; };
id: string; id: string;
imageId?: null | string;
imageUrl?: null | string;
name: string; name: string;
parentId?: string; parentId?: string;
}; };