mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
- Renamed downloads.tsx to index.tsx - Added new downloads/series.tsx page - Downloading now saves series primary image - Downloads index page now shows series primary image with downloaded episode counter - Updated EpisodeCard.tsx to display more information - Moved season dropdown from SeasonPicker.tsx into its own component SeasonDropdown.tsx - Updated navigation in DownloadItem.tsx to direct to series page when a downloaded episode is clicked
21 lines
764 B
TypeScript
21 lines
764 B
TypeScript
import {getPrimaryImageUrlById} from "@/utils/jellyfin/image/getPrimaryImageUrlById";
|
|
import {BaseItemDto} from "@jellyfin/sdk/lib/generated-client";
|
|
import useImageStorage from "@/hooks/useImageStorage";
|
|
import {apiAtom} from "@/providers/JellyfinProvider";
|
|
import {useAtom} from "jotai";
|
|
import {storage} from "@/utils/mmkv";
|
|
|
|
const useDownloadHelper = () => {
|
|
const [api] = useAtom(apiAtom);
|
|
const {saveImage} = useImageStorage();
|
|
|
|
const saveSeriesPrimaryImage = async (item: BaseItemDto) => {
|
|
if (item.Type === "Episode" && item.SeriesId && !storage.getString(item.SeriesId)) {
|
|
await saveImage(item.SeriesId, getPrimaryImageUrlById({ api, id: item.SeriesId }))
|
|
}
|
|
}
|
|
|
|
return { saveSeriesPrimaryImage }
|
|
}
|
|
|
|
export default useDownloadHelper; |