mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
# New downloads page for downloaded TV-Series
- 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
This commit is contained in:
21
utils/download.ts
Normal file
21
utils/download.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user