mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +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) =>
|
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(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -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;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user