fucking images man

This commit is contained in:
Violet Caulfield
2025-01-26 09:42:02 -06:00
parent 8c2fd6fd2a
commit c6ebb37ce5
2 changed files with 4 additions and 1 deletions

View File

@@ -34,16 +34,20 @@ export async function fetchItemImage(
data.text()
.then((text) => {
console.debug("Writing image to file")
FileSystem.writeFile(
getImagePath(itemId, imageType, width, height),
text
).then(() => {
console.debug("Successfully wrote image to file")
resolve(URL.createObjectURL(data));
}).catch(() => {
console.debug("Unable to write image to file, exiting...")
resolve(URL.createObjectURL(data));
});
})
.catch(() => {
console.debug("Unable to read blob, not storing")
resolve(URL.createObjectURL(data));
});
})

View File

@@ -6,6 +6,5 @@ import { ImageType } from "@jellyfin/sdk/lib/generated-client/models";
export const useItemImage = (itemId: string, imageType?: ImageType, width?: number, height?: number) => useQuery({
queryKey: [QueryKeys.ItemImage, itemId, imageType, width, height],
queryFn: () => fetchItemImage(itemId, imageType, width, height),
gcTime: Infinity,
retry: 3
});